From: <one...@us...> - 2003-04-02 01:06:55
|
Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl In directory sc8-pr-cvs1:/tmp/cvs-serv25747/hibernate/impl Modified Files: ScheduledCollectionUpdate.java SessionFactoryImpl.java SessionImpl.java Log Message: * fixed a theoretical problem with caching and queued adds * fixed a real problem with sorted sets * re-enabled two-phase loading for sets Index: ScheduledCollectionUpdate.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/ScheduledCollectionUpdate.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ScheduledCollectionUpdate.java 2 Feb 2003 04:19:51 -0000 1.5 --- ScheduledCollectionUpdate.java 2 Apr 2003 01:06:51 -0000 1.6 *************** *** 5,8 **** --- 5,9 ---- import java.sql.SQLException; + import net.sf.hibernate.AssertionFailure; import net.sf.hibernate.HibernateException; import net.sf.hibernate.collection.CollectionPersister; *************** *** 21,25 **** public void execute() throws SQLException, HibernateException { persister.softlock(id); ! if ( collection.empty() ) { persister.remove(id, session); } --- 22,30 ---- public void execute() throws SQLException, HibernateException { persister.softlock(id); ! if ( !collection.wasInitialized() ) { ! if ( !collection.hasQueuedAdds() ) throw new AssertionFailure("bug processing queued adds"); ! //do nothing - we only need to notify the cache... ! } ! else if ( collection.empty() ) { persister.remove(id, session); } Index: SessionFactoryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionFactoryImpl.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** SessionFactoryImpl.java 29 Mar 2003 04:08:47 -0000 1.15 --- SessionFactoryImpl.java 2 Apr 2003 01:06:52 -0000 1.16 *************** *** 22,26 **** import java.util.Map; import java.util.Properties; - import java.util.Collections; import javax.naming.NamingException; --- 22,25 ---- Index: SessionImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/impl/SessionImpl.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** SessionImpl.java 29 Mar 2003 04:08:47 -0000 1.29 --- SessionImpl.java 2 Apr 2003 01:06:52 -0000 1.30 *************** *** 271,275 **** // if the collection is initialized and it was previously persistent // initialize the dirty flag ! dirty = initialized && loadedPersister!=null && isDirty(collection); if ( log.isDebugEnabled() && dirty && loadedPersister!=null ) log.debug( --- 271,276 ---- // if the collection is initialized and it was previously persistent // initialize the dirty flag ! dirty = ( initialized && loadedPersister!=null && isDirty(collection) ) || ! ( !initialized && dirty ); //only need this so collection with queued adds will be removed from JCS cache if ( log.isDebugEnabled() && dirty && loadedPersister!=null ) log.debug( *************** *** 2470,2474 **** } ! else if( entry.dirty ) { // else if it's elements changed entry.doupdate = true; } --- 2471,2475 ---- } ! else if (entry.dirty) { // else if it's elements changed entry.doupdate = true; } *************** *** 2503,2507 **** CollectionEntry entry = getCollectionEntry(coll); ! return entry.initialized && ( entry.dirty || coll.hasQueuedAdds() ); } --- 2504,2508 ---- CollectionEntry entry = getCollectionEntry(coll); ! return entry.initialized && entry.dirty; //( entry.dirty || coll.hasQueuedAdds() ); } *************** *** 2588,2592 **** } ! public boolean isCollectionReadOnly(PersistentCollection collection) { CollectionEntry ce = getCollectionEntry(collection); return ce!=null && ce.loadedPersister.isInverse(); --- 2589,2593 ---- } ! public boolean isInverseCollection(PersistentCollection collection) { CollectionEntry ce = getCollectionEntry(collection); return ce!=null && ce.loadedPersister.isInverse(); |