something like: protected Object load() { Entity entity = ...; if(entity.getVersion() != version) { Session.get().warn("Someone else modified the foo in the database, please review these changes and re-enter your data."); version = entity.getVersioni(); form.clearInput(); } return entity; }
Martijn On Mon, Dec 8, 2008 at 10:00 PM, James Carman <[EMAIL PROTECTED]> wrote: > Somehow you have to reset the cached version value (assume you'd use a > validator for this I guess), since it's not the same as the one in the db, > right? > > On Mon, Dec 8, 2008 at 3:34 PM, Martijn Dashorst <[EMAIL PROTECTED] >> wrote: > >> The user doesn't have to refresh, because she already gets the new >> values... that is why there's optimistic locking in place. One >> solution would be to clear the user input and have them re-enter the >> data. >> >> Martijn >> >> On Mon, Dec 8, 2008 at 9:23 PM, James Carman <[EMAIL PROTECTED]> >> wrote: >> > Right, you'll have to figure out what you want to do at that point. You >> > could set an error message telling them to refresh the screen I guess (as >> > long as it's a bookmarkable URL and it will actually refresh stuff)? >> > >> > On Mon, Dec 8, 2008 at 3:15 PM, Martijn Dashorst < >> [EMAIL PROTECTED] >> >> wrote: >> > >> >> Why? >> >> >> >> There's nothing keeping you from storing the version too, and checking >> >> that against the newly loaded entity... The question is... what do you >> >> do when the version is modified from your original object? >> >> >> >> Martijn >> >> >> >> On Mon, Dec 8, 2008 at 9:11 PM, James Carman < >> [EMAIL PROTECTED]> >> >> wrote: >> >> > There are many ways to skin a cat. LDMs pretty much throw optimistic >> >> > locking out the window, agreed (since they just go get a "fresh" copy >> of >> >> the >> >> > object each time typically)? So, if you want to use optimistic >> locking, >> >> > then you shouldn't be using LDMs in the first place. >> >> > >> >> > On Mon, Dec 8, 2008 at 2:28 PM, Erik van Oosten <[EMAIL PROTECTED] >> >> >wrote: >> >> > >> >> >> So I guess you're not levering the optimistic locking of Hibernate. >> >> >> >> >> >> Regards, >> >> >> Erik. >> >> >> >> >> >> >> >> >> James Carman wrote: >> >> >> >> >> >>> It would work the same way, since it grabs its stuff up-front. >> Behind >> >> the >> >> >>> scenes, you use a LDM as the actual model. >> >> >>> >> >> >>> On Mon, Dec 8, 2008 at 1:56 PM, Daan van Etten <[EMAIL PROTECTED]> >> wrote: >> >> >>> >> >> >>> >> >> >>> >> >> >>>> Hi James, >> >> >>>> >> >> >>>> How does this work with a Hibernate-managed object? Did you test it >> >> with >> >> >>>> Hibernate? >> >> >>>> >> >> >>>> >> >> >>>> >> >> >>> >> >> >>> >> >> >> >> >> >> -- >> >> >> Erik van Oosten >> >> >> http://www.day-to-day-stuff.blogspot.com/ >> >> >> >> >> >> >> >> >> >> >> >> --------------------------------------------------------------------- >> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> >> >> >> > >> >> >> >> >> >> >> >> -- >> >> Become a Wicket expert, learn from the best: http://wicketinaction.com >> >> Apache Wicket 1.3.4 is released >> >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. >> >> >> >> --------------------------------------------------------------------- >> >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> > >> >> >> >> -- >> Become a Wicket expert, learn from the best: http://wicketinaction.com >> Apache Wicket 1.3.4 is released >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]