Hi, This can be solved by using a generic LoadableDetachableModel implementation that loads a model via an interface that constructs a new entity.
Preferably it is a subclass of a persisting LoadableDetachableModel that has access to EntityManager. The new POJO entity can be stored in the session at low cost without effort. Once entity is persisted, the LDM changes its behavior into that of the super class, and the model object (POJO) is removed from the session. Now its primary key that is used to get it back from EntityManager is stored in the session as usual. The Wicket LDM concept is very powerful. Kind Regards, Bernard On Sat, 04 May 2013 15:35:37 +0200, you wrote: > >Am 03.05.2013 16:28, schrieb Bertrand Guay-Paquet: >>> Best solution I can imagine would be if there would be a callback or >>> overridable method which is called when the user navigates to a page >>> and another one which is called when the user leaves a page. Those >>> methods would be great to prepare and cleanup models. Are there such >>> methods? >> No method will reliably inform you that a user left a page. His WIFI >> could die, the power could go out, etc. You must clear all expired >> temporary data after some time. If your data is stored in the session, >> that's done automatically for you. > >Thanks for your answer. > >I understand, that there can be situations when a user actually doesn't >leave a page the usual way, but if there were a method as described, it >could at least be helpful for all the preceding page-leave-events under >normal conditions. > >At the moment I think I could handle the problem of unsaved data by >using a Stateful Session Bean. > >Best Regards, > >Christian > > > >Mit freundlichen Grüßen, /// Kind Regards, > Christian Reiter --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org