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.  [ 3 posts ] 
Author Message
 Post subject: auto insert to DB after ICollection.Add()
PostPosted: Sun Jul 30, 2006 8:50 am 
Newbie

Joined: Fri Jul 28, 2006 4:32 am
Posts: 9
Lo,
i've got the collection mapped as <set> in my class and whenever I do the Add(something) method over this collection - the NHibernate insert this object (row) into DB just by oneself (automatically) and the other hand when I force method Clear() over the collection [which remove all objects from collection] the NHibernate doesn't delete this object (row) from the mapped table. So the result is that there in DB is many many rows which should not be there...

I just need to save or update these objects manually in program - by saveOrUpdate() command. Auto update/insert/delete after Add()/Remove() is unwanted. Any idea why this happens to me or how to prevent it?

Thank you very much for your answers.


Last edited by lc on Mon Jul 31, 2006 12:29 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 30, 2006 6:24 pm 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
never heard about automatic persistence in Hibernate. can you post some code?

cheers,
radu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 31, 2006 8:12 am 
Newbie

Joined: Fri Jul 28, 2006 4:32 am
Posts: 9
problem was that I didn't close the session...I do session.Close() after each manipulation with persistent objects and everything seems ok now. Thanks a lot.


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

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.