openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: "join fetch" doesnt work as expected
Date Tue, 22 Feb 2011 20:27:34 GMT
Hmmm...  It's my understanding that a JOIN FETCH should preload the
relationship, even if it's marked as being Lazy.  Have you performed a SQL
trace to see if we're even attempting to load the relationship?  Unless
someone else speaks up, this would seem to be a bug.

Kevin

On Tue, Feb 22, 2011 at 12:08 PM, Marc Logemann <li@logemann.org> wrote:

> Hi,
>
> assume this code:
>
>        Query query = getEntityManager().createQuery("SELECT b FROM Box b
> JOIN FETCH b.order.orderPositions WHERE b.id = ?1");
>        query.setParameter(1, boxId);
>        List<Box> boxList = query.getResultList();
>
> The relationship is:
>
> box  <-- 1:1 ---> order <-- 1:n --> orderPositions
>
> When doing this query, i would expect that the orderPositions are attached
> but they are null (order is attached to the box as expected but thats 1:1) .
> I checked this right after the query.getResultList() call.
> What am i missing here?
>
> thanks for infos.
>
> ---
> regards
> Marc Logemann
> http://www.logemann.org
> http://www.logentis.de
>
>
>
>
>

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