Author: ste...@jb...
Date: 2006-08-06 12:12:09 -0400 (Sun, 06 Aug 2006)
New Revision: 10230
Modified:
branches/Branch_3_2/Hibernate3/src/org/hibernate/persister/entity/AbstractEntityPersister.java
branches/Branch_3_2/Hibernate3/src/org/hibernate/tuple/entity/EntityMetamodel.java
branches/Branch_3_2/Hibernate3/test/org/hibernate/test/legacy/Glarch.hbm.xml
Log:
HHH-1980 : disallow combination of <version/> and optimistic-lock
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/persister/entity/AbstractEntityPersister.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/persister/entity/AbstractEntityPersister.java 2006-08-06 16:11:24 UTC (rev 10229)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/persister/entity/AbstractEntityPersister.java 2006-08-06 16:12:09 UTC (rev 10230)
@@ -2603,7 +2603,7 @@
public void delete(Serializable id, Object version, Object object, SessionImplementor session)
throws HibernateException {
final int span = getTableSpan();
- boolean isImpliedOptimisticLocking = entityMetamodel.getOptimisticLockMode() > Versioning.OPTIMISTIC_LOCK_VERSION;
+ boolean isImpliedOptimisticLocking = !entityMetamodel.isVersioned() && entityMetamodel.getOptimisticLockMode() > Versioning.OPTIMISTIC_LOCK_VERSION;
Object[] loadedState = null;
if ( isImpliedOptimisticLocking ) {
// need to treat this as if it where optimistic-lock="all" (dirty does *not* make sense);
Modified: branches/Branch_3_2/Hibernate3/src/org/hibernate/tuple/entity/EntityMetamodel.java
===================================================================
--- branches/Branch_3_2/Hibernate3/src/org/hibernate/tuple/entity/EntityMetamodel.java 2006-08-06 16:11:24 UTC (rev 10229)
+++ branches/Branch_3_2/Hibernate3/src/org/hibernate/tuple/entity/EntityMetamodel.java 2006-08-06 16:12:09 UTC (rev 10230)
@@ -253,6 +253,9 @@
if ( optimisticLockMode > Versioning.OPTIMISTIC_LOCK_VERSION && !dynamicUpdate ) {
throw new MappingException( "optimistic-lock setting requires dynamic-update=\"true\": " + name );
}
+ if ( versionPropertyIndex != NO_VERSION_INDX && optimisticLockMode > Versioning.OPTIMISTIC_LOCK_VERSION ) {
+ throw new MappingException( "version and optimistic-lock are not a valid combination : " + name );
+ }
hasCollections = foundCollection;
hasMutableProperties = foundMutable;
Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/legacy/Glarch.hbm.xml
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/legacy/Glarch.hbm.xml 2006-08-06 16:11:24 UTC (rev 10229)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/legacy/Glarch.hbm.xml 2006-08-06 16:12:09 UTC (rev 10230)
@@ -7,8 +7,7 @@
<class name="Glarch"
table="`glarchez`"
proxy="GlarchProxy"
- dynamic-update="true"
- optimistic-lock="dirty">
+ dynamic-update="true">
<!--cache-->
<id type="string" column="tha_key" length="32">
|