Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Carlos Pita
> > I've been coding some > > examples with convoluted entity lazy-loaded associations and, despite > > my previous fears, detaching/re-attaching it from/to the hibernate > > session works like a charm. I think I will tag all my editable > > entities as Serializable and embrace this approach. > > S

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Carlos Pita
> > the object is reloaded just for setting a property and discarded > > again; also, depending on how you configure your transactions, you > > could end up persisting partial non-validated changes (although I > > should say that from my observations this doesn't happen inside a > > vanilla OpenSes

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Eelco Hillenius
> Also, reloading the entity from "state zero" every time could be > problematic when incrementally updating it using ajax. Not if you save it every time :) But yes, if you do an update in steps, and only want to commit changes at the end (relevant not only with Ajax, but also e.g. with a wizard)

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Carlos Pita
On 4/6/07, Carlos Pita <[EMAIL PROTECTED]> wrote: > On 4/6/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > > > It's not a good idea to use LoadableDetachableModel for entities that > > > you edit. Because they are detached after every request. > > > > Sorry, but I don't agree with that :) LDMs are

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Eelco Hillenius
> On 4/6/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > > > It's not a good idea to use LoadableDetachableModel for entities that > > > you edit. Because they are detached after every request. > > > > Sorry, but I don't agree with that :) LDMs are my favorite models for > > such use. The only thi

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Carlos Pita
> > If it works well, anything outside of a transaction should well... be > outside the transaction :) So anything touched in a read-only (auto > started) transaction should never be upgraded to a write one. I'm not > a Spring expert though. But that's what you can expect from the > library. This

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Carlos Pita
On 4/6/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > > It's not a good idea to use LoadableDetachableModel for entities that > > you edit. Because they are detached after every request. > > Sorry, but I don't agree with that :) LDMs are my favorite models for > such use. The only thing you have

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Eelco Hillenius
> Anyway, I've done little tests with spring OpenSessionInViewFilter and > things DO work as I desire. I mean changes are committed only when a > @Transactional method is invoked, not during events that simply update > the model without submitting. Imo, have separate transaction methods (service/

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Eelco Hillenius
> It's not a good idea to use LoadableDetachableModel for entities that > you edit. Because they are detached after every request. Sorry, but I don't agree with that :) LDMs are my favorite models for such use. The only thing you have to keep in mind is to persist any changes coming in with a requ

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Carlos Pita
Hi Matej, what about entities with lazy loaded associations that are not easily detachable/re-attachable from/to their hibernate session? I was never sure on how to do this, maybe dto is a healthier alternative despite introducing a lot of duplication. Anyway, I've done little tests with spring O

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-06 Thread Matej Knopp
It's not a good idea to use LoadableDetachableModel for entities that you edit. Because they are detached after every request. LoadableDetachableModel is best for View scenarios, when you need fresh data on every request. In case you are editing entities, like you do, load the entity only once, e.

Re: [Wicket-user] onSelectionChanged and session-in-view

2007-04-05 Thread Carlos Pita
Same can be said for ajax update behaviour. See for example: TextField password = new TextField("password"); AjaxFormComponentUpdatingBehavior ajaxBehaviour = new AjaxFormComponentUpdatingBehavior("onblur") { protected void onUpdate(AjaxRequestTarget target) { System.out.pr

[Wicket-user] onSelectionChanged and session-in-view

2007-04-05 Thread Carlos Pita
Hi all, I'm a bit concerned about onSelectionChanged event effectively binding my model. Suppose my model is a LoadableDetachableModel that is loaded from the repository every time. Normally (upon form submission) nothing will be bound after successfully passing validation; then additional logic w