Just make your where class = to the selct cluase. In case any colum is changed, it fails.
(if you really need this)
.V
David Erickson wrote:
Hi I am using Struts with Hibernate in a webapplication.. we are using forms etc. The problem I am currently trying to decide how to handle is thus:
Assume user 1 loads up an object in a form and is modifying it. Assume user 2 loads up the same object in a form and is also modifying it. User 1 submits the modified object. User 2 also submits the object, however his is out of date and I would like the webapp to tell him that and show the differences that exist.
What is the best way to use hibernate to deal with this? What I have attempted is using the built in timestamp feature in MySQL, I have a field in my object that is timestamp but does not insert or update, thus mysql controls its value. Then when the user submits the object I loaded another copy of that object from the DB and tried to compare their dates.. however this gave me an error saying:
net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 1, of class: cmcflex.salesweb.model.prospect.Prospect
because of the object I loaded to compare.
What do do? Is there a better strategy for tackling this? I tried using the actual <timestamp> in the properties for my object, but then when I tried to submit the object the generated sql said "when id=? AND timestamp=?" meaning it would not update if the timestamp is different, and I'm unsure if I could even determine if it did or did not update.
Thanks in advance, David
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

