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
- SchemaUpdate asks for all referenced mapping documents when updating a single tableHHH-2638Resolved issue: HHH-2638
- Fields quotes must be applied in queries to prevent mix reserved words with fields namesHHH-2622Resolved issue: HHH-2622
- Hibernate Serializable classes do not declare serialVersionUIDHHH-2586Resolved issue: HHH-2586
- replicate() of non-versioned entiy can result in wrong value for version in entity cacheHHH-2378Resolved issue: HHH-2378Max Rydahl Andersen
- ClassCastException caused when Hibernate caches instance under user provided keyHHH-2321Resolved issue: HHH-2321
- Hibernate XML Mapping should not depend on dom4jHHH-2125Resolved issue: HHH-2125Yoann Rodière
- HibernateException hidden during flush using XA with WAS6HHH-2124Resolved issue: HHH-2124Chris Bredesen
- Providing an escape sequence for Criteria queriesHHH-2077Resolved issue: HHH-2077
- Delete not always executingHHH-2064Resolved issue: HHH-2064
- Record User parameters directly int the Hibernate sessionHHH-2061Resolved issue: HHH-2061
- Section 19.2 of the documentation does not show Ehcache as supporting clusters. It does.HHH-2059Resolved issue: HHH-2059Diego Plentz
- Generified Associations are not supported by hibernateHHH-2051Resolved issue: HHH-2051
- There is an bug in InformixDialect preventing generator-class=native to work.HHH-2043Resolved issue: HHH-2043
- Database Dialect for Progress 9.1DHHH-1950Resolved issue: HHH-1950Christian Beikov
- Interfaces PreInsertEventListener and PreUpdateEventListener are badly javadoc-documentedHHH-1942Resolved issue: HHH-1942Diego Plentz
- QuerySyntaxException "with-clause expressions did not reference from-clause element to which the with-clause was associated"HHH-1930Resolved issue: HHH-1930Steve Ebersole
- The MultipleHiloPertablegenerator.class wraps at 2**31-1, but javadoc claims Long.HHH-1869Resolved issue: HHH-1869
- Autogeneration of primary keys for Sybase IDENTITY columns fails with latest jConn3 driverHHH-1860Resolved issue: HHH-1860Former user
- Allow join on any property using property-refHHH-1829Resolved issue: HHH-1829Anthony Patricio
- negation of EXISTS in hql query does not workHHH-1780Resolved issue: HHH-1780Strong Liu
- NullPointerException at IdentNode.resolveAsNakedComponentPropertyRefLHS(IdentNode.java:195HHH-1746Resolved issue: HHH-1746Steve Ebersole
- Returning resultset from PostgreSQL stored procedureHHH-1745Resolved issue: HHH-1745Diego Plentz
- Wrong order of binding parameters in Restrictions.in for composite primary keysHHH-1743Resolved issue: HHH-1743Diego Plentz
- SQL join is missed in Criteria queries for join/alias on foreign key as part of composite primary key (many-to-one association)HHH-1742Resolved issue: HHH-1742Diego Plentz
- Build-time instrumentation breaks lazy="proxy"HHH-1740Resolved issue: HHH-1740Steve Ebersole
- When using EJB3 data corruption can occur when you are using merge() and rollback()HHH-1717Resolved issue: HHH-1717
- AbstractEntityPersister causes an exception when a row in a joined table is missing with fetch="select"HHH-1713Resolved issue: HHH-1713Steve Ebersole
- persistent collections with property-ref to secondary tables cannot be joined in HQLHHH-1710Resolved issue: HHH-1710Steve Ebersole
- Named parameters ignored when single apostrophe encountered within an SQL commentHHH-1706Resolved issue: HHH-1706Steve Ebersole
- Fields quetes must be applied in queries to prevent mix reserved words with fields namesHHH-1703Resolved issue: HHH-1703
- Add outer join support for aliases on DetachedCriteriaHHH-1696Resolved issue: HHH-1696Diego Plentz
- BatchingBatcher.doExecuteBatch logs stack trace for StaleStateExceptionHHH-1686Resolved issue: HHH-1686
- Instrumentation and proxies conflictHHH-1680Resolved issue: HHH-1680
- optimistic-lock="dirty|all" is ignored at delete timeHHH-1677Resolved issue: HHH-1677Steve Ebersole
- org.hibernate.cfg.Configuration should obey standard java.util.Properties overwrite rulesHHH-1676Resolved issue: HHH-1676
- Configuration serialization error: filterDefinitions map not serializableHHH-1674Resolved issue: HHH-1674
- TransactionHelper leaves JDBC connections unclosed, when the connection is set to autocommit falseHHH-1669Resolved issue: HHH-1669
- many-to-one set.add() already existing items are addedHHH-1666Resolved issue: HHH-1666
- Missing join clause on generated SQL for a select of a subclass propertyHHH-1652Resolved issue: HHH-1652
- hibernate does not find an existing sequence from an Oracle databaseHHH-1651Resolved issue: HHH-1651
- Exception while resuming a transaction is silently eatenHHH-1648Resolved issue: HHH-1648Emmanuel Bernard
- Several collections are only updated, never accessed.HHH-1647Resolved issue: HHH-1647
- Bad code in FastClass.equalsHHH-1646Resolved issue: HHH-1646Scott Marlow
- Hibernate.isPropertyInitialized() returns false on instrumented transient objectHHH-1625Resolved issue: HHH-1625Emmanuel Bernard
50 of 52
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
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.