Issues
- Hibernate increases version on readHHH-5867Resolved issue: HHH-5867Strong Liu
- ClassCastException with parameter as CASE resultsHHH-4700Resolved issue: HHH-4700Steve Ebersole
- Add setReadOnly(true) method to the Criteria interfaceHHH-3578Resolved issue: HHH-3578Former user
- Would like HQL support in criteria.OrderHHH-2987Resolved issue: HHH-2987
- Native SQLQuey combined with addEntity forces to retrieve all columnsHHH-2974Resolved issue: HHH-2974
- Incomplete/non-informative javadocs for events systemHHH-2958Resolved issue: HHH-2958Diego Plentz
- Hibernate Serializable classes do not declare serialVersionUIDHHH-2586Resolved issue: HHH-2586
- Criteria.setMaxResults(int) broken with Oracle9Dialect, only works with a long in a HQL queryHHH-2509Resolved issue: HHH-2509
- unexpected object loading with Mixing table per class hierarchy with table per subclassHHH-2422Resolved issue: HHH-2422
- replicate() of non-versioned entiy can result in wrong value for version in entity cacheHHH-2378Resolved issue: HHH-2378Max Rydahl Andersen
- Regression: optional properties under a <join> tag no longer update properlyHHH-2320Resolved issue: HHH-2320Former user
- SQLQuery executeUpdate doesn't respect Query.setFlushMode()HHH-2238Resolved issue: HHH-2238Steve Ebersole
- NullpointerException in DefaultDeleteEventListener.deleteTransientEntityHHH-2146Resolved issue: HHH-2146Former user
- bool data type for PostgreSQLDialect get rewritten to numeric 1/0 value instead of "true"/"false"HHH-2144Resolved issue: HHH-2144
- PersistentMap.remove() may return UNKNOWN object that can cause ClassCastException in client codeHHH-2142Resolved issue: HHH-2142
- merge with bidirectional one-to-one may failHHH-2138Resolved issue: HHH-2138Steve Ebersole
- HQL generates wrong sql statementsHHH-2136Resolved issue: HHH-2136
- Hibernate Deserialization: In org.hibernate.type.SerializableType the code makes a test for the return of a null object by simply testing the object as to whether or not it is null.HHH-2135Resolved issue: HHH-2135Steve Ebersole
- HibernateException hidden during flush using XA with WAS6HHH-2124Resolved issue: HHH-2124Chris Bredesen
19 of 19
Hibernate increases version on read
Rejected
Description
Attachments
1
Details
Assignee
Strong LiuStrong LiuReporter
ChristianChristianComponents
Affects versions
Priority
Critical
Details
Details
Assignee
Strong Liu
Strong LiuReporter
Christian
ChristianComponents
Affects versions
Priority
Created January 25, 2011 at 8:43 AM
Updated March 7, 2014 at 5:31 PM
Resolved May 20, 2011 at 7:30 AM
Activity
Show:
Brett MeyerMarch 7, 2014 at 5:31 PM
Bulk closing rejected tickets in "resolved" state.
Strong LiuMay 20, 2011 at 7:30 AM
it is not a bug, this is caused by your own custom type impl.
hibernate use equals to check if a property is changed (aka dirty).
in your test, the MyComponent#type is null, and with your ShortEnumUserType#equals, it returns false if the type is null,
so, you actually tell hibernate if the type is null, then the managed entity is dirty, that's why hibernate schedule a update.
add
On a special constellation hibernate increases the internal used version of an entity on a read operation. For example if you save an entity the version is initial set. If you execute a query to read the entity afterwards, the version increases on this read. Please notice that the entity has NOT changed in the meantime. An update of the version must not happen here.
This problem seems to occur only if you have a few prequisites:
1. An entity, which has a component or subclasses
2. The component/subclasses must use an custom usertype
3. The read operation is covered by transaction
The bug leads to StaleObjectStateExceptions in production because the version has changed after a read operation by another thread.
An example is attached.