and if a user just refreshes the page? or you use it as a response page somewhere else? then suddenly everything is empty?
On 3/29/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote: > > One problem I have due to avoiding DTOs is that most of the time I don't > > want to serialize my form models, because they are (often big) entities > with > > lazy loaded associations. So in principle I would use an > > LoadableDetachableModel to load the entity from the repository each time > the > > model is reattached. But suppose I'm updating a UserProfile. The first > time > > it would be ok to populate the model from the persistent profile to be > > updated. But once the form is submitted there's no point in loading the > > profile from the repository again because its properties would be > > overwritten from those coming from the form anyway. So I'm tempted to > > subclass AbstractDetachableModel so that it loads the profile from the > > repository upon creation, but instantiates a brand new profile to be > > populated from the form upon reattachment. Is there a better pattern for > > this? Anyone has run into the same problem? > > Sounds like that could work. Btw, you can still just use > LoadableDetachableModels. Something like this? > > class SomeModel extends LoadableDetachableModel { > > protected Object load() { > return new Foo(); > } > } > > new SomeModel(anotherFooThatWasLoaded); > > The thing I want to point out here is that you can just initialize the > LDM with the object you loaded from the database, for the first > request, and then implement load like this to get fresh instances on > next requests. > > 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 > ------------------------------------------------------------------------- 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