Lazy Initialization Question
I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
It's just a billing system. The problem comes up now in very simple use cases. Currently all we're doing is trying to load a collection with a list of Order domain objects from the Client domain object. final SortableDataProviderOrder provider = new RepositoryDataProviderOrder(getOrderRepository()) { @Override protected ListOrder load() { return new ArrayListOrder(getClientModelObject().getOrders()); } }; On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote: It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
Hi! If I understand correctly, getClientModelObject() will need a session. Is that a problem? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: It's just a billing system. The problem comes up now in very simple use cases. Currently all we're doing is trying to load a collection with a list of Order domain objects from the Client domain object. final SortableDataProviderOrder provider = new RepositoryDataProviderOrder(getOrderRepository()) { �...@override protected ListOrder load() { return new ArrayListOrder(getClientModelObject().getOrders()); } }; On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote: It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
getClientModel gets an instance of EntityModel which contains a reference to a repository and an id. The repository has a reference to the hibernate SessionFactory. On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote: Hi! If I understand correctly, getClientModelObject() will need a session. Is that a problem? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: It's just a billing system. The problem comes up now in very simple use cases. Currently all we're doing is trying to load a collection with a list of Order domain objects from the Client domain object. final SortableDataProviderOrder provider = new RepositoryDataProviderOrder(getOrderRepository()) { @Override protected ListOrder load() { return new ArrayListOrder(getClientModelObject().getOrders()); } }; On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote: It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
Session factory or also an open session? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: getClientModel gets an instance of EntityModel which contains a reference to a repository and an id. The repository has a reference to the hibernate SessionFactory. On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote: Hi! If I understand correctly, getClientModelObject() will need a session. Is that a problem? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: It's just a billing system. The problem comes up now in very simple use cases. Currently all we're doing is trying to load a collection with a list of Order domain objects from the Client domain object. final SortableDataProviderOrder provider = new RepositoryDataProviderOrder(getOrderRepository()) { �...@override protected ListOrder load() { return new ArrayListOrder(getClientModelObject().getOrders()); } }; On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote: It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
Session factory, sorry. On Sat, 2010-07-24 at 12:31 +0300, Martin Makundi wrote: Session factory or also an open session? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: getClientModel gets an instance of EntityModel which contains a reference to a repository and an id. The repository has a reference to the hibernate SessionFactory. On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote: Hi! If I understand correctly, getClientModelObject() will need a session. Is that a problem? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: It's just a billing system. The problem comes up now in very simple use cases. Currently all we're doing is trying to load a collection with a list of Order domain objects from the Client domain object. final SortableDataProviderOrder provider = new RepositoryDataProviderOrder(getOrderRepository()) { @Override protected ListOrder load() { return new ArrayListOrder(getClientModelObject().getOrders()); } }; On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote: It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Lazy Initialization Question
Then I think you need to open a session to activate lazy fetching. 2010/7/24 Sam Barrow s...@sambarrow.com: Session factory, sorry. On Sat, 2010-07-24 at 12:31 +0300, Martin Makundi wrote: Session factory or also an open session? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: getClientModel gets an instance of EntityModel which contains a reference to a repository and an id. The repository has a reference to the hibernate SessionFactory. On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote: Hi! If I understand correctly, getClientModelObject() will need a session. Is that a problem? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: It's just a billing system. The problem comes up now in very simple use cases. Currently all we're doing is trying to load a collection with a list of Order domain objects from the Client domain object. final SortableDataProviderOrder provider = new RepositoryDataProviderOrder(getOrderRepository()) { �...@override protected ListOrder load() { return new ArrayListOrder(getClientModelObject().getOrders()); } }; On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote: It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For
Re: Lazy Initialization Question
I just added opensessioninviewfilter, I'm still getting org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.sixserve.domain.Server.controlPanelOptions, no session or session was closed The error occurs inside a service method, called from a wicket link add(new LinkDomainObject(link, getAccount()) { @Override public void onClick() { getApplicationService().doThing(getModelObject()); } }); On Sat, 2010-07-24 at 12:36 +0300, Martin Makundi wrote: Then I think you need to open a session to activate lazy fetching. 2010/7/24 Sam Barrow s...@sambarrow.com: Session factory, sorry. On Sat, 2010-07-24 at 12:31 +0300, Martin Makundi wrote: Session factory or also an open session? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: getClientModel gets an instance of EntityModel which contains a reference to a repository and an id. The repository has a reference to the hibernate SessionFactory. On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote: Hi! If I understand correctly, getClientModelObject() will need a session. Is that a problem? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: It's just a billing system. The problem comes up now in very simple use cases. Currently all we're doing is trying to load a collection with a list of Order domain objects from the Client domain object. final SortableDataProviderOrder provider = new RepositoryDataProviderOrder(getOrderRepository()) { @Override protected ListOrder load() { return new ArrayListOrder(getClientModelObject().getOrders()); } }; On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote: It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail:
Re: Lazy Initialization Question
Where did you add opensessioninviewfilter? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I just added opensessioninviewfilter, I'm still getting org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.sixserve.domain.Server.controlPanelOptions, no session or session was closed The error occurs inside a service method, called from a wicket link add(new LinkDomainObject(link, getAccount()) { �...@override public void onClick() { getApplicationService().doThing(getModelObject()); } }); On Sat, 2010-07-24 at 12:36 +0300, Martin Makundi wrote: Then I think you need to open a session to activate lazy fetching. 2010/7/24 Sam Barrow s...@sambarrow.com: Session factory, sorry. On Sat, 2010-07-24 at 12:31 +0300, Martin Makundi wrote: Session factory or also an open session? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: getClientModel gets an instance of EntityModel which contains a reference to a repository and an id. The repository has a reference to the hibernate SessionFactory. On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote: Hi! If I understand correctly, getClientModelObject() will need a session. Is that a problem? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: It's just a billing system. The problem comes up now in very simple use cases. Currently all we're doing is trying to load a collection with a list of Order domain objects from the Client domain object. final SortableDataProviderOrder provider = new RepositoryDataProviderOrder(getOrderRepository()) { �...@override protected ListOrder load() { return new ArrayListOrder(getClientModelObject().getOrders()); } }; On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote: It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail:
Re: Lazy Initialization Question
I fixed it, I didn't realize I had to move the filter above the wicket filter On Sat, 2010-07-24 at 13:00 +0300, Martin Makundi wrote: Where did you add opensessioninviewfilter? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I just added opensessioninviewfilter, I'm still getting org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.sixserve.domain.Server.controlPanelOptions, no session or session was closed The error occurs inside a service method, called from a wicket link add(new LinkDomainObject(link, getAccount()) { @Override public void onClick() { getApplicationService().doThing(getModelObject()); } }); On Sat, 2010-07-24 at 12:36 +0300, Martin Makundi wrote: Then I think you need to open a session to activate lazy fetching. 2010/7/24 Sam Barrow s...@sambarrow.com: Session factory, sorry. On Sat, 2010-07-24 at 12:31 +0300, Martin Makundi wrote: Session factory or also an open session? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: getClientModel gets an instance of EntityModel which contains a reference to a repository and an id. The repository has a reference to the hibernate SessionFactory. On Sat, 2010-07-24 at 12:20 +0300, Martin Makundi wrote: Hi! If I understand correctly, getClientModelObject() will need a session. Is that a problem? ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: It's just a billing system. The problem comes up now in very simple use cases. Currently all we're doing is trying to load a collection with a list of Order domain objects from the Client domain object. final SortableDataProviderOrder provider = new RepositoryDataProviderOrder(getOrderRepository()) { @Override protected ListOrder load() { return new ArrayListOrder(getClientModelObject().getOrders()); } }; On Sat, 2010-07-24 at 12:07 +0300, Martin Makundi wrote: It's difficult to comment exactly not knowing the actual use case and background.. but maybe another design approach would help? And also it's just my opinnion to try to avoid lazy initialization in GUI. Somebody might disagree ;] ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The only alternative I've found is DTOs, which would not be practical at all, we have a very large domain model. On Sat, 2010-07-24 at 11:58 +0300, Martin Makundi wrote: I would avoid using lazy entities in GUI. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: The entitymodel accesses a generic repository implementation. So I would definitely need to use open session in view to avoid these? On Sat, 2010-07-24 at 11:29 +0300, Martin Makundi wrote: I would recommend against making your GUI dependent on persistence container... ...but yes you will need active database connection for lazy loading entities. ** Martin 2010/7/24 Sam Barrow s...@sambarrow.com: I'm getting hibernate lazy initialization exceptions. I was under the impression that a smart entity model would fix this (http://wicketinaction.com/2008/09/building-a-smart-entitymodel/) is that true? Or do i need opensessioninview as well? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: