openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <>
Subject Re: Same JPQL, different results?
Date Fri, 29 Apr 2011 19:02:29 GMT
I can help with the different size of the result list. 

I think you're seeing
OPENJPA-894 . The first time the results of a FETCH JOIN query are read from
the database OpenJPA only returns the unique rows. Subsequent FETCH JOIN
queries will return duplicates (as defined by the spec). There's also OPENJPA-1365 , which
complicates things.

I think the best workaround for these issues is to make use of OpenJPA's
FetchPlans to eagerly load a relationship. 

Something like this would work :

OpenJPAEntityManager em = OpenJPAPersistence.cast(entityManager);

FetchPlan plan = em.getFetchPlan();
plan.addField(Node.class, "children");

Query query = em.createQuery("SELECT n from Node n");

I'm not sure whether this will help with your detachment problem though, but
it's worth a try.

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message