openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pawel Veselov <pawel.vese...@gmail.com>
Subject Re: Lazy many-to-many properties don't load on demand? (2.1.1)
Date Tue, 27 Dec 2011 16:18:55 GMT
On Tue, Dec 27, 2011 at 4:27 AM, Boblitz John <John.Boblitz@bertschi.com>wrote:

> Is your persistent context still active?
>

Yep. The operations are pretty much after each other.

            TypedQuery<E_Category> q2 =
                    em.createNamedQuery(Q.LIST_CATS, E_Category.class);
            for (E_Category db : q2.getResultList()) {
                appList.categories.add(new Category(db, true));
            }

Inside the 'new Category()', I access entity.apps, which is:

public class E_Category {
...
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "categories")
public Collection<E_App> apps;
...
}

Mapping in the other direction is also LAZY.


Thanks,
  Pawel.

> -----Urspr√ľngliche Nachricht-----
> > Von: Pawel Veselov [mailto:pawel.veselov@gmail.com]
> > Gesendet: Dienstag, 27. Dezember 2011 12:03
> > An: users@openjpa.apache.org
> > Betreff: Lazy many-to-many properties don't load on demand? (2.1.1)
> >
> > Hi.
> >
> > I'm using 2.2.1
> >
> > I have declared a ManyToMany property, with lazy fetch type
> > (my entities are all property based).
> > The property does not load when accessed (the collection is null).
> > Setting it to eager loading works, but I don't want (for performance
> > reasons) for it to always load.
> >
> > Is there something I may be missing?
> >
> > Thank you,
> >   Pawel.
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message