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.  [ 2 posts ] 
Author Message
 Post subject: Session.Lock magic
PostPosted: Wed Dec 19, 2007 10:47 am 
Beginner
Beginner

Joined: Tue Mar 27, 2007 4:54 am
Posts: 47
Hibernate version:
1.2

Sometimes things are more confusing when it works better than expected than vice versa. Now I've run into a "problem" like this.

If I reattach an object(-graph) to a isession using session.lock, how can nhib be aware of the changes? I was quite sure that the snapshots were held inside the isession (used when loading the object) and not in the entity itself, nor did I think the entity was aware of the isession but only the other way around.

To me the above makes it impossible to only persist the changes and not update the whole object graph. But, obviously, I'm totally wrong. How does this work? How can nhib keep track of changes/get the original values when reattaching an object to a new isession?

Because this somehow works, I cannot see why SaveOrUpdate() doesn't work the same magical way? This method works as expected (unfortunatly) in a reattached scenario - doesn't keep track of changes, but updates the whole object graph.

Regards
Roger


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 19, 2007 10:58 am 
Beginner
Beginner

Joined: Tue Mar 27, 2007 4:54 am
Posts: 47
Sorry. I was stupid. Obviously nhib doesn't keep track of changes from "load time" when reattaching an object, but from "reattach time".


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