Does anyone use a custom validator to implement this type of stuff?  I'm not
crazy about a model implementing this functionality, especially during a
"get" operation.  Also, your model has to be aware of your view (the call to
the form's clearInput() method).  I don't know.  Something about it just
doesn't seem right to me.

On Mon, Dec 8, 2008 at 4:32 PM, James Carman <[EMAIL PROTECTED]>wrote:

> Using this, you have to make sure this model gets reset on form submit,
> too, right?  With this, you have to make sure you reset the model's cached
> version value upon successful form submit, too, right?
>
>
> On Mon, Dec 8, 2008 at 4:13 PM, Martijn Dashorst <
> [EMAIL PROTECTED]> wrote:
>
>> 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]
>>
>>
>

Reply via email to