-->
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.  [ 6 posts ] 
Author Message
 Post subject: Updating unmodified object in another session
PostPosted: Mon Jan 10, 2005 6:53 am 
Newbie

Joined: Thu Jan 06, 2005 8:05 am
Posts: 13
Hi folks.

What happens when object is loaded in one session, not being modified in web tier (user just pressed Submit without changing any field value), and updated using Session.saveOrUpdate() in another session? Can Hibernate somehow know that object hasn't been change thus never issue UPDATE sql command?
Looking at "net.sf.hibernate.SQL" log category, I can see that UPDATE sql is executed :-(
Same thing is when only one field is changed, and Hibernate seems to execute UDPATE stetement with *all* fields included?!

Or maybe Im missing something to set it properly?

Thanx,
Vjeran


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 7:01 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
It's not possible for Hibernate to know the previous state of your object unless you either keep it associated with the session or use select-before-update=true


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 9:20 am 
Newbie

Joined: Tue Dec 21, 2004 10:53 am
Posts: 8
Location: Stuttgart/Germany
how can i bind a session to an object, so if i save the object in another session, only the changed objects are saved?
Only a general explanation to do this is needed, a small example is also fine.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 9:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Just keep the session open and reuse it


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 9:27 am 
Newbie

Joined: Tue Dec 21, 2004 10:53 am
Posts: 8
Location: Stuttgart/Germany
yes, this is a solution, but i'm working with spring/hibernate.
there that is i think another way, because the hibernatetemplate is managing that.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 10, 2005 9:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well, I know how to do it with Hibernate - probably ask the Spring guys if they know how to do it with Spring


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