[hibernate-dev] Possible to confirm that versioning is broken forPersistentSets?

Josh Moore josh.moore at gmx.de
Thu Aug 31 09:09:32 EDT 2006


Ok. The isDirty()/write()/add()/clearDirty() idiom explains why the 
patch was producing NPEs in other tests. Otherwise, the only other 
failures that seemed they could be related were from the optlock tests. 
Two were failing earlier (see 
http://opensource.atlassian.com/projects/hibernate/secure/attachment/12560/TEST-org.hibernate.test.optlock.OptimisticLockTest.txt) 
but all are failing with the patch, e.g.:

Testcase: testOptimisticLockAllDelete took 0.134 sec
         Caused an ERROR
Batch update returned unexpected row count from update [0]; actual row 
count: 0; expected: 1

~Josh.

Steve Ebersole wrote:
> I've made some changes here locally which attempt to group fixes to a
> bunch of these seemingly related issues.  So for PersistentSet.add()
> (for example), I have:
> 
> 
> 	public boolean add(Object value) {
> 		Boolean exists = isOperationQueueEnabled() ?
> 				readElementExistence(value) : null;
> 		if ( exists == null ) {
> 			boolean initiallyDirty = isDirty();
> 			write();
> 			boolean actuallyAdded = set.add( value );
> 			if ( !actuallyAdded ) {
> 				if ( ! initiallyDirty && isDirty() ) {
> 					clearDirty();
> 				}
> 			}
> 			return actuallyAdded;
> 		}
> 		else if ( exists.booleanValue() ) {
> 			return false;
> 		}
> 		else {
> 			queueOperation( new SimpleAdd(value) );
> 			return true;
> 		}
> 	}
> 
> But I need to get time to properly test these changes before I commit
> them.



More information about the hibernate-dev mailing list