-->
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: saveOrUpdateCopy and version field
PostPosted: Wed Feb 04, 2004 6:16 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 6:24 pm
Posts: 45
Hi All -
I'm trying to use saveOrUpdateCopy to propagate changes from a remote webapp into the db. This works nicely, except the version field is ignored in the sense that updates to version n should not be allowed if the db version != n.

That is, during the update, if I use saveOrUpdate(), if the version field of my incoming object doesn't match the db's version, I get an exception (as expected).

If I use saveOrUpdateCopy(), the version field is simply incremented and the object is saved without exception.

Is this correct behavior?

some background on our app design:

- remote web app
- ejb facade to app server

update sequence is somthing like this:
webapp requests object from app server
webapp receives object via remote ejb
webapp applies changes to object from app server
webapp sends object to app server for update
app server stores updates using saveOrUpdateCopy(object)

I was previously using saveOrUpdate(object), but you can guess the problem with that is that the update is always persisted, even if no data was changed. I was trying to avoid this situation by using saveOrUpdateCopy which copies fields of the "diconnected" object into a "connected" version of the object.

thanks for any advice

tyson


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 6:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This is fixed in 2.1.2.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 04, 2004 7:19 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 6:24 pm
Posts: 45
perfect - works great

thanks again

tyson


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.