On Nov 23, 2007 4:29 AM, Angelo Chen <[EMAIL PROTECTED]> wrote: > > lasitha wrote: > > > > Since the above events fire on both the original request and the one > > from the redirect, you'll probably need a null check to differentiate: > > can you explain more about about this null > check, any example why we have to check? thanks.
I should say first that i'm not sure this is best practice. It's sort of obvious, rudimentary and not particularly elegant - if there's a better way i hope someone will point it out. @Persist("flash") Entity entity; @Inject private Datastore datastore; void onPrepare() { if(entity == null) entity = datastore.loadEntity(); else datastore.reattach(entity); } * Datastore is my data-access service and reattach() just facades Session.lock(). * As i mentioned earlier, onPrepare() is one of a few places you might do this. I'd say as a general rule, the earlier in the request, the better. Cheers, lasitha --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]