You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Sam Barrow <sa...@sambarrow.com> on 2010/07/24 10:12:57 UTC

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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Sam Barrow <sa...@sambarrow.com>.
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 <sa...@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 Link<DomainObject>("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 <sa...@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 <sa...@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 <sa...@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 SortableDataProvider<Order> provider = new
> >> >> >> > RepositoryDataProvider<Order>(getOrderRepository()) {
> >> >> >> >                        @Override
> >> >> >> >                        protected List<Order> load() {
> >> >> >> >                                return new ArrayList<Order>(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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
> >> >> >> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >> >> >> >
> >> >> >> >> >> >> >
> >> >> >> >> >> >>
> >> >> >> >> >> >> ---------------------------------------------------------------------
> >> >> >> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >> >> >>
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >> > ---------------------------------------------------------------------
> >> >> >> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> ---------------------------------------------------------------------
> >> >> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > ---------------------------------------------------------------------
> >> >> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> ---------------------------------------------------------------------
> >> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > ---------------------------------------------------------------------
> >> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Where did you add opensessioninviewfilter?

**
Martin

2010/7/24 Sam Barrow <sa...@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 Link<DomainObject>("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 <sa...@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 <sa...@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 <sa...@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 SortableDataProvider<Order> provider = new
>> >> >> > RepositoryDataProvider<Order>(getOrderRepository()) {
>> >> >> >                        @Override
>> >> >> >                        protected List<Order> load() {
>> >> >> >                                return new ArrayList<Order>(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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
>> >> >> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >> >> >> >
>> >> >> >> >> >> >
>> >> >> >> >> >>
>> >> >> >> >> >> ---------------------------------------------------------------------
>> >> >> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >> >> >>
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >> > ---------------------------------------------------------------------
>> >> >> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> ---------------------------------------------------------------------
>> >> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > ---------------------------------------------------------------------
>> >> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Sam Barrow <sa...@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 Link<DomainObject>("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 <sa...@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 <sa...@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 <sa...@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 SortableDataProvider<Order> provider = new
> >> >> > RepositoryDataProvider<Order>(getOrderRepository()) {
> >> >> >                        @Override
> >> >> >                        protected List<Order> load() {
> >> >> >                                return new ArrayList<Order>(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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
> >> >> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >> >> >
> >> >> >> >> >> >
> >> >> >> >> >>
> >> >> >> >> >> ---------------------------------------------------------------------
> >> >> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >> >>
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> > ---------------------------------------------------------------------
> >> >> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> ---------------------------------------------------------------------
> >> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > ---------------------------------------------------------------------
> >> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Then I think you need to open a session to activate lazy fetching.

2010/7/24 Sam Barrow <sa...@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 <sa...@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 <sa...@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 SortableDataProvider<Order> provider = new
>> >> > RepositoryDataProvider<Order>(getOrderRepository()) {
>> >> >                        @Override
>> >> >                        protected List<Order> load() {
>> >> >                                return new ArrayList<Order>(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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
>> >> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >> >> >
>> >> >> >> >> >
>> >> >> >> >>
>> >> >> >> >> ---------------------------------------------------------------------
>> >> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > ---------------------------------------------------------------------
>> >> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Sam Barrow <sa...@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 <sa...@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 <sa...@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 SortableDataProvider<Order> provider = new
> >> > RepositoryDataProvider<Order>(getOrderRepository()) {
> >> >                        @Override
> >> >                        protected List<Order> load() {
> >> >                                return new ArrayList<Order>(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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
> >> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >> ---------------------------------------------------------------------
> >> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > ---------------------------------------------------------------------
> >> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Session factory or also an open session?

**
Martin

2010/7/24 Sam Barrow <sa...@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 <sa...@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 SortableDataProvider<Order> provider = new
>> > RepositoryDataProvider<Order>(getOrderRepository()) {
>> >                        @Override
>> >                        protected List<Order> load() {
>> >                                return new ArrayList<Order>(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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
>> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Sam Barrow <sa...@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 <sa...@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 SortableDataProvider<Order> provider = new
> > RepositoryDataProvider<Order>(getOrderRepository()) {
> >                        @Override
> >                        protected List<Order> load() {
> >                                return new ArrayList<Order>(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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
> >> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >> ---------------------------------------------------------------------
> >> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >> > ---------------------------------------------------------------------
> >> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!

If I understand correctly, getClientModelObject() will need a session.
Is that a problem?

**
Martin

2010/7/24 Sam Barrow <sa...@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 SortableDataProvider<Order> provider = new
> RepositoryDataProvider<Order>(getOrderRepository()) {
>                        @Override
>                        protected List<Order> load() {
>                                return new ArrayList<Order>(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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
>> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >> >
>> >> >> >
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Sam Barrow <sa...@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 SortableDataProvider<Order> provider = new
RepositoryDataProvider<Order>(getOrderRepository()) {
			@Override
			protected List<Order> load() {
				return new ArrayList<Order>(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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
> >> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >> >
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
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 <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
>> >> > For additional commands, e-mail: users-help@wicket.apache.org
>> >> >
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Sam Barrow <sa...@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 <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
I would avoid using lazy entities in GUI.

**
Martin

2010/7/24 Sam Barrow <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Sam Barrow <sa...@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 <sa...@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-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Lazy Initialization Question

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
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 <sa...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org