-->
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.  [ 4 posts ] 
Author Message
 Post subject: NHibernate makes strange stuff, and I don't know why
PostPosted: Wed Sep 07, 2005 10:54 am 
Beginner
Beginner

Joined: Fri May 20, 2005 5:06 am
Posts: 28
I don't know why, but NHibernate makes many queries to do unnecessary stuff when flushing the session after e.g. saving one item like:

- getting all lazy collections of objects in memory
- selecting, deleting and inserting again many-to-many data

I never changed these objects, so I don't know why NHibernates thinks they need to be updated with the DB again.

I made a small sample app copying all data access code from there, trying to reproduce it, but there everything went perfect.

I'm really desperate now, because my project, on which I worked for a year is now at stake. So please, if anyone have any suggestions, so please feel free to make them.

Thanks, Rainer.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 11:40 am 
Senior
Senior

Joined: Sat May 14, 2005 8:40 am
Posts: 130
Can you post your mappings? The cascade settings can be tricky here. If you set cascade of a relation to 'save-update' or 'all', NHibernate follows those relations to determine if there has anything changed, even when you know for sure that nothing has changed in the related objects.

_________________
Cuyahoga


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 07, 2005 12:07 pm 
Beginner
Beginner

Joined: Fri May 20, 2005 5:06 am
Posts: 28
I think the cascading updates are a part of the problem. But two interesting points on that:

When I set all cascadings to "none" and try to save an object, then the many-to-many stuff (Select, Delete, Insert same data again) stops. But in my sample app, I made a similar model, an there I setted the cascading to "all", and none of my problems came.

Second interesting point: although all cascadings are set to "none", at saving NHibernate still gets all lazy collections at flushing.

I can post my mappings, but because there are many classes, I first want to try, if we can isolate the problem.


Top
 Profile  
 
 Post subject: STUPID ME
PostPosted: Thu Sep 08, 2005 3:52 am 
Beginner
Beginner

Joined: Fri May 20, 2005 5:06 am
Posts: 28
I finally found the problem and as everyone thought already, it was me :oops: !!! I set the bag fileds in my classes as IList, but the properties as an inherited class of IList which I created. This caused my problems.

Thanks alot for your help.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.