Hello everybody!
I'm wondering if I'm using NHibernate the "wrong way". Whenever I fetch an object that contains a set, all entries in the database, related to that object, are first deleted and then inserted again. I guess this results from a dirty collection. But how can the collection be dirty if hibernate has just fetched it?
Hibernate version:
1.2.0.4
Mapping documents:
<set name="Attributes" table="user_attributes" lazy="false" fetch="select">
<key column="userId" />
<composite-element class="PersistenceLayer.Entities.EntityAttribute, PersistenceLayer">
<property name="Value" column="value" />
<many-to-one name="Attribute" column="attributeId" class="PersistenceLayer.Entities.User.UserAttribute, PersistenceLayer" fetch="select" lazy="false" />
</composite-element>
</set>
Code between sessionFactory.openSession() and session.close():
Spring's HibernateDaoSupport
Full stack trace of any exception that occurs:
2008-01-30 13:08:56,230 [10] DEBUG NHibernate.Impl.SessionImpl [(null)] - collection initialized
2008-01-30 13:08:56,230 [10] DEBUG NHibernate.Impl.ConnectionManager [(null)] - after autocommit
2008-01-30 13:08:56,230 [10] DEBUG NHibernate.Impl.ConnectionManager [(null)] - aggressively releasing database connection
2008-01-30 13:08:56,230 [10] DEBUG NHibernate.Impl.SessionImpl [(null)] - transaction completion
2008-01-30 13:08:56,230 [10] DEBUG Spring.Data.NHibernate.HibernateAccessor [(null)] - Eagerly flushing Hibernate session
2008-01-30 13:08:56,230 [10] DEBUG NHibernate.Impl.SessionImpl [(null)] - flushing session
2008-01-30 13:08:56,230 [10] DEBUG NHibernate.Impl.CollectionEntry [(null)] - Collection dirty: [PersistenceLayer.Entities.User.User.Attributes#1]
2008-01-30 13:08:56,230 [10] DEBUG NHibernate.Impl.SessionImpl [(null)] - Flushing entities and processing referenced collections
2008-01-30 13:08:56,230 [10] DEBUG NHibernate.Impl.AbstractVisitor [(null)] - Processing collection for role PersistenceLayer.Entities.User.User.Attri
butes
Name and version of the database you are using:
Oracle 9i
|