Issues
- Hibernate increases version on readHHH-5867Resolved issue: HHH-5867Strong Liu
- In the Session.flush method has a lost of perfomance about 50% when flush a large amout of dataHHH-5062Juraci Paixão Kröhling
- EventListenerConfigurator uses Ejb3Configuration but could use AnnotationConfiguration insteadHHH-5052Resolved issue: HHH-5052Emmanuel Bernard
- @TableGenerator throws Unsupported exception - error performing isolated workHHH-5019Resolved issue: HHH-5019
- ClassCastException with parameter as CASE resultsHHH-4700Resolved issue: HHH-4700Steve Ebersole
- one-to-one non-lazy loading but Filters Not Applied.HHH-4026Resolved issue: HHH-4026Steve Ebersole
- <join>: <key>: different composite keyHHH-4024
- One-to-one: property-ref: foreign key: composite-idHHH-4014Resolved issue: HHH-4014
- Hibernate proxies Groovy's getMetaClass method breaking proxies when used with GroovyHHH-3870Resolved issue: HHH-3870Vlad Mihalcea
- Error with sql generated for set of subclass A in a peer subclass B.HHH-3752Resolved issue: HHH-3752Former user
- ManyToOneType.isModifiedHHH-3730Resolved issue: HHH-3730
- Add setReadOnly(true) method to the Criteria interfaceHHH-3578Resolved issue: HHH-3578Former user
- JTATransactionFactory bug when Transaction cannot be found in JNDIHHH-3481Resolved issue: HHH-3481Steve Ebersole
- JTASessionContext broken for WebSphereHHH-3472Resolved issue: HHH-3472Steve Ebersole
- query.uniqueResult() potentially generates out of memory by calling list()HHH-3432Resolved issue: HHH-3432
- distribution bundles cglib directly instead of the hibernate repackagingHHH-3430Resolved issue: HHH-3430Steve Ebersole
- Update all libs that are used in Hibernate to the latest versionHHH-3417Resolved issue: HHH-3417
- Configuration.generateSchemaUpdateScript() uses getTableMetadata() inconsistantlyHHH-3413Resolved issue: HHH-3413
- Wrong "jsdk.jar" referenced in the tutorialHHH-3397Resolved issue: HHH-3397Diego Plentz
- Typo in chapter 7.6HHH-3190Resolved issue: HHH-3190Diego Plentz
- All *Event must inherit AbstractEventHHH-2926Resolved issue: HHH-2926Diego Plentz
21 of 21
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.
@Override
public boolean equals(final Object x, final Object y) {
if ( x == null || y == null ) {
return false;
}
return x.equals( y );
}
add
if(x==y)return true;
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.