-->
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: NHibernate update behaviour
PostPosted: Tue Feb 14, 2006 3:13 pm 
Beginner
Beginner

Joined: Wed Oct 05, 2005 2:08 pm
Posts: 23
I want to wrap my Hibernate BO's in a viewmodel object to adapt it to a form so that I can use databinding. I make a copy of my NHibernate BO for the ViewModel to work with. When the user clicks "Save", the viewModel attempts to copy the changes from the copy to the original NHibernate BO proxy. This allows me to have Cancel functionality. The problem is that the code to copy the changes from the duplicated BO to the original NHibernate BO looks suspisciously like the code I would have to write for mapping (predictable and boring: o.prop1 = c.prop1, etc).

It would be ideal if I could just use the working copy and discard the NHibernate proxy if the user clicks "Save." Assuming the working copy is an exact binary copy of the NHibernate proxy (cloned using binary serialization), if I attempt to update the copy using the Session will it assume it is a new object because the instance is not in the cache or will it identify it correctly based on it's ID? Will child collections still be updated effeciently?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 9:45 am 
Beginner
Beginner

Joined: Wed Oct 05, 2005 2:08 pm
Posts: 23
put more simply: If I make an exact binary copy of an object, dereference the original, and then attempt to update it in NHibernate will it identify it as in the cache or not?


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.