- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试根据给定条件搜索 View 。此 View 有几个字段用于我的应用程序中用户可能想要搜索的多个不同实体。
当我输入要搜索的实体的名称时,我在调用 .findByCriteria()
之前将名称字段的限制添加到分离条件。这会导致 .findByCriteria()
检索包含我要查找的名称的结果列表。
此外,当我查看我的日志时,我可以看到 hibernate 调用了一个 select
语句。
我现在已经在我的 View 中添加了另一个实体,其中包含一些可搜索的字段。当我尝试搜索与这个新实体相关的字段时,我在日志中遇到异常。
当我查看异常日志时,我可以看到 hibernate 在 select
之后调用 select
语句和 update
语句(我不是要更新记录,只是在列表中检索它)。
那么为什么当我为我的新实体调用 .findByCriteria()
时 hibernate 调用更新?
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
SQL that is executed:
Hibernate:
select
*
from
( select
this_.SEARCH_ID as SEARCH1_35_0_,
this_.ST_NM as ST24_35_0_
from
SEARCH_RESULT this_
where
this_.LOAN_TYPE=? )
where
rownum <= ?
DEBUG 2012-03-21 11:37:19,332 142195 (http-8181-3:org.springframework.orm.hibernate3.HibernateTemplate): [org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:389)] Eagerly flushing Hibernate sessionDEBUG 2012-03-21 11:37:19,384 142247 (http-8181-3:org.hibernate.SQL): [org.hibernate.jdbc.util.SQLStatementLogger.logStatement(SQLStatementLogger.java:111)]
update
SEARCH_RESULT
set
ADDR_LINE1=?,
ASSGND_REGION=?,
BASE_DEAL_ID=?,
ST_NM=?
where
SEARCH_ID=?
最佳答案
可能会发生更新,因为 Hibernate 被设置为在执行查询之前执行自动刷新,所以如果持久化上下文认为它有脏数据,它将尝试更新它。没有看到代码我不能确定,但我猜即使 search_result 是一个 View ,你相应的 Java 对象在 getters 上被注释并且对象有匹配的 setters。 Hibernate 不区分表和 View ,如果您调用 setter,Hibernate 将假定它有数据更改要更新。
您可以通过添加 @Immutable 注释(或 hibernate.@Entity(mutable = false) 来调整为 View 构建 Java 对象的方式,具体取决于您使用的版本。这应该足以向 Hibernate 表明不要刷新更改。您还可以直接注释字段并摆脱 setter ,以便 SearchResult 对象的使用者知道它是只读的。
关于java - Hibernate/Spring HibernateTemplate.findByCriteria(Deatched Criteria dc) 在 View 上执行sql更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9807479/
我是 dc.js 的新手,我对 dc 的灵 active 有一些疑问。 首先,我一直在寻找答案,但还没有找到任何答案。 1) 我正在使用 dc.sunburst 图表。我想知道是否有可能创建 Zoom
谁能解释一下 ldap 字符串部分的构成。 我有一个是: string strSQL = "SELECT mail FROM 'LDAP://DC=amrs,DC=win,DC=ml,dc=COM'
他们已经就如何将 dc.js 简单地用作图形库(例如绘制饼图、条形图...)而不需要交叉过滤器进行了各种讨论,例如,如果您只想在数据已经是一个(标签,值)。 我没有找到任何关于如何做到这一点的例子。这
当我点击数据表中的一行时,我需要过滤其他图表。 我做了 my_table.on('pretransition', function (table) { table.selectAll('td
我想显示小切片( chart.minAngleForLabel(0.05) )的标签,避免文本重叠。 我添加了一个将标签移向外边缘的renderlet: .on('renderlet', func
如何在新列的 dc.js 数据表中添加带有事件监听器的按钮。 如果可能的话,我基本上想添加自定义 html。 最佳答案 添加按钮只是返回列的 html 的问题 dc.dataTable (dom) .
这个问题在这里已经有了答案: Initial Range selection in DC.js chart (1 个回答) 关闭 7 年前。 我创建了 this可视化,并希望在解释文本中使用预定义的
我用 dc.js 制作了一个热图,我想知道 dc.js 中是否有热图的键或图例函数。我在互联网上搜索过,但似乎找不到内置的方法,那么有没有其他人解决过这个问题? 最佳答案 我遇到了同样的任务,我所做的
我有一个具有以下模型的数据源: [ { days : 3, value : 500 }, { days : 30,
如果过滤后 dc.js 中的行图值为零,我们如何隐藏。我们有这样的代码: var kurum=data.dimension(function(d){return ""+ d.KURUM;});
自 1.4.0-alpha.06 版起,Crossfilter 支持数组维度 https://github.com/crossfilter/crossfilter/wiki/API-Reference
我希望在 dc.js 的多维数据集中绘制与连续变量关联的几个直方图。虽然使用 dc.barChart 组件很容易实现这一点,但我希望对这些直方图进行面积归一化。在我的例子中,bin 宽度是统一的,所以
我目前正在尝试弄清楚如何使用 DJ.js 和 D3.js 计算要显示的唯一记录数 数据集如下所示: id,name,artists,genre,danceability,energy,key,loud
在此图表上:http://junklogic.com/dcjs/barpie/index-controls.html 我的示例 JSON 文件中有与严重性评级相对应的图例,该文件代表我将在生产中使用的
我有以下数据。 我可以使用 dc.js 创建一个吗? 有人可以帮助我使用 dc js 创建直方图吗? 搜索了整个论坛但除了这个post 找不到有用的东西. 日期: numbers11012035242
以下是一组数据: var data = [{ machine1: [ {x:"20/12/2014", y:2}, {x:"21/12/2014", y:10} ]},{ machine2:
我使用 dc.js 和 crossfilter 创建了一个折线图。当前图表如下所示: 必需:我希望左上角的事件非事件图例位于中心图表的下方(底部),并且 x 轴刻度标签应该从一月到十二月开始。我在下面
我仍在尝试使用 dc 和 crossfilter 将图表链接在一起,这里我将表格和饼图链接在一起。链接在图表和表格之间起作用,因此当我单击饼图时,表格会相应更新。 然而,当我点击超链接时,这一行似乎没
我对允许打印填充填充对象的修复有疑问... 所以,完整的故事是我们使用了 Windows GDI FloodFill 函数,我们注意到它在打印机上不起作用,所以我在 inet 上找到的是创建一个内存
我是 MFC 编程的新手。这些天我正在使用 Jeff Prosise 的书来学习 MFC 编程。我遇到过:CClientDC dc (this); 我从 CClientDC 类的定义中找到了一个构造函
我是一名优秀的程序员,十分优秀!