Re: LoadableDetachableModel - should I call deatch() manually?
Hi! Timo Rantalaiho wrote: @Override public void onDetach() { positionToDisplay.detach(); super.onDetach(); } ... } Thanks for your help! It fixed my problem. Artur -- View this message in context: http://www.nabble.com/LoadableDetachableModel---should-I-call-deatch%28%29-manually--tp18335895p18365767.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
LoadableDetachableModel - should I call deatch() manually?
Hi, When I create LoadableDetachableModel the onDeatch() and deatch() methods are never called. The load method is only called once. Becouse of it I get LazyInitializationException from Hibernate. Should I call deatch() manually or is there something wrong with my LoadableDetachableModel? Here is a code. public class ClientLoadableDetachableModel extends LoadableDetachableModel { private Long clientId; public ClientLoadableDetachableModel(Long clientId) { super(); this.clientId = clientId; } @Override protected Object load() { return Locator.getClientService().findClientById(clientId); } public Client getClient() { return (Client) super.getObject(); } public Long getClientId() { return clientId; } } Thanks for help, Artur -- View this message in context: http://www.nabble.com/LoadableDetachableModel---should-I-call-deatch%28%29-manually--tp18335895p18335895.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LoadableDetachableModel - should I call deatch() manually?
The detach method should be called by the component that uses the model, there should be no need for you to call detach manually. Artur W. wrote: Hi, When I create LoadableDetachableModel the onDeatch() and deatch() methods are never called. The load method is only called once. Becouse of it I get LazyInitializationException from Hibernate. Should I call deatch() manually or is there something wrong with my LoadableDetachableModel? Here is a code. public class ClientLoadableDetachableModel extends LoadableDetachableModel { private Long clientId; public ClientLoadableDetachableModel(Long clientId) { super(); this.clientId = clientId; } @Override protected Object load() { return Locator.getClientService().findClientById(clientId); } public Client getClient() { return (Client) super.getObject(); } public Long getClientId() { return clientId; } } Thanks for help, Artur - Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/LoadableDetachableModel---should-I-call-deatch%28%29-manually--tp18335895p18340483.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: LoadableDetachableModel - should I call deatch() manually?
On Tue, 08 Jul 2008, Michael Sparer wrote: The detach method should be called by the component that uses the model, there should be no need for you to call detach manually. ...unless the model is not the default model of any Component. For example you can have public class EmployeePanel extends Panel { private final IModelPosition positionToDisplay; public EmployeePanel(String id, IModelEmployee employee, IModelPosition positionToDisplay { super(id, employee); this.positionToDisplay = positionToDisplay; ... } @Override public void onDetach() { positionToDisplay.detach(); super.onDetach(); } ... } The same goes for nested models, the outer model (assigned to a component) must delegate the detach call to the inner model. Best wishes, Timo -- Timo Rantalaiho Reaktor Innovations OyURL: http://www.ri.fi/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]