-->
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: What causes an object to emit the "UPDATE"?
PostPosted: Fri Nov 18, 2005 9:39 am 
Regular
Regular

Joined: Mon Jul 18, 2005 4:10 am
Posts: 92
Location: Poland
Hi

I'm currently facing a big performace problem with my web app using NHibernate. The source of the problem is "search" functionality, when search results are bigger (e.g. 1000 rows or more).
I discovered with sql server profiler that the most of the time takes the bunch of "UPDATE" commands executed with every single record within the result set. It is only a time-waster because I do not alter any of those objects.

My current workaround is to avoid session flushing in those cases , but it is not enough - I need session flushing for example to store some preferences etc. on the search page.

Can anybody tell me why not-even-touched objects perform those annoying UPDATEs? And how to avoid this? :shock:

_________________
michal


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 22, 2005 8:57 am 
Beginner
Beginner

Joined: Wed Oct 05, 2005 5:35 am
Posts: 47
Location: France
Your data probably doesn't quite match the property definition - so whan class is loaded some properties are detected as dirty and are updated.
If you have log4net configured - look in logs for something like:
"Persister.AbstractEntityPersister - YourClass.Property is dirty".
Happens often with Nullable columns that can't be Nulls in native VS datatypes (dates, integers, etc).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 23, 2005 7:40 am 
Regular
Regular

Joined: Mon Jul 18, 2005 4:10 am
Posts: 92
Location: Poland
Yes, you are right. I was using standard Date type to store nulls ( setting it to DateTime.MinValue puts NULL into database). Just found that as a simpler alternative to Nullables.

Now I have to replace all such cases with the NullableDateTime , I checked - it fixes my "updates" problem.

Thanks for help.

_________________
michal


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.