我有两个问题
即使抽象类可以完成接口的功能,为什么我们在java中需要接口?
在搜索中,我发现抽象类无法完成接口功能的地方,即一个类需要实现多个接口。
这是在java中提出接口概念的唯一原因吗?
接口中的静态最终变量有什么用?欢迎需要说明接口中变量用法的示例程序。
提前致谢。
在选择查询中出现 OptimisticLockException
javax.persistence.OptimisticLockException 在 org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:1415) [hibernate3.jar:3.6.10.Final] 在 org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1336) [hibernate3.jar:3.6.10.Final] 在 org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1317) [hibernate3.jar:3.6.10.Final] 在 org.hibernate.ejb.QueryImpl。getResultList (QueryImpl.java:255) [hibernate3.jar:3.6.10.Final]
该查询是一个简单的选择查询,涉及多个实体和where子句,例如
从 table1 a 、table2 b 、table3 c...中选择不同的 a.id 、b.type ... 其中 b.id=a 和 c.id in ...
众所周知,当我们尝试更新脏实体时会发生 OptimisticLockException,但是选择查询如何导致此异常。是否有任何可能性或者这是一个错误?