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
|