> 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 to keep in mind is to persist any > > changes coming in with a request you are interested in, or you'll lose > > them. But if you do that, it'll work fine. > > > > I used to thought like that too (a couple of hours ago :) ), but I > find the approach clumsy when a lot of ajax round-trips are involved;
Inefficient by default rather. Yes, you have to choose whether you want objects that are always recent and have a small memory foot print, or you want a 'working object' that can readily be edited. But if you enable a cache for the objects you are working with, it's hardly less effecient to use the LDMs. > 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 OpenSessionInViewFilter spring setting). I don't really understand what you mean here I'm afraid. If you save an object, surely you validate completely? And also, Wicket would touch only the properties it has models/ components attached to. The object you loaded from the store/ database is valid (or it wouldn't have been there in the first place, right?), so the only things that have to be validated are those extra changes. > 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. Sounds good. Can you share a code snippet? Eelco ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user