Hibernate version: 1.2.0.2002
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using: SQL Sever 2005
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
Problems with Session and transaction handling? No
We have a mapping document where an association is mapped as follows:
<bag name="Segments" access="field.camelcase-underscore" cascade="all">
<key column="TRIP_ID" />
<one-to-many class="SegmentImpl"/>
An instance of the class containing this collection is loaded. The collection is empty (i.e. it is non-null but has no items). No changes are made and the object is saved. On flushing the session, SessionImpl.IsUpdateNecessary(persister, cannotDirtyCheck, status, dirtyProperties, values, types) returns true, indicating the object is dirty and needs saving. Stepping through this function the visitor that looks at each property finds the bag and gets it's collection entry. The collection entry has a dirty flag set which is why IsUpdateNeccessary returns true.
Can someone explain this? We have a collection that is empty on retrieval and empty on saving so why is it considered dirty?
I have verified that if I comment out the association shown above from the HBM and save no updates occur.
|