These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Collection is always dirty - results in deletes and insert
PostPosted: Wed Jan 30, 2008 8:22 am 
Beginner
Beginner

Joined: Wed Jan 16, 2008 4:00 am
Posts: 41
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.