You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Matt Schmidt <ms...@gmail.com> on 2010/10/01 00:03:55 UTC

Re: Lazy load exception with LoadableDetachableModel

Ok after further review, my problem was because I was getting this model
from a DataProvider where I was feeding the DataProvider a List AFTER
retrieving from the persistence layer, instead of doing it IN the
DataProvider. Thanks for the help!

On Wed, Sep 29, 2010 at 6:02 PM, James Carman <ja...@carmanconsulting.com>wrote:

> Are you detaching your model?  If not, it could be returning a Product
> object that was obtained during a different Hibernate session.
>
> On Wed, Sep 29, 2010 at 5:53 PM, Matt Schmidt <ms...@gmail.com>
> wrote:
> > I am using LoadableDetachableModel's to load my persisted objects from
> the
> > database, but I am still getting a lazy load exception when accessing a
> > property that is a Set.
> >
> > For example: take persistent POJO Product that has this property, where
> > ProductType is another persistent POJO:
> >
> > private Set<ProductType> productTypes;
> >
> >
> > I get the lazy load when trying to access this property from the LDM:
> >
> > Collection<ProductType> x = ((Product)
> model.getObject()).getProductTypes();
> >
> > for(ProductType pt : x) {     //lazy load here
> >
> > .....
> >
> >
> > What am I missing?
> >
> > Thanks,
> > Matt
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>