Daryl Stultz schrieb:
> On Tue, Nov 17, 2009 at 5:27 AM, Michael Simons
> <[email protected]>wrote:
> 
>> Hello,
>>
>> OpenJPA-1365: DISTINCT keyword has no effect with JOIN FETCH queries
>>
>> We're porting a formerly JDO based application to JPA.
>> We wanted to heavily use JOIN FETCHs to reduce the number of SQL statements
>> generated.
>> We do not know how to get rid of those weird duplicates produced by a JPQL
>> statement including a
>> join fetch clause.
>>
> 
> The duplicates are "proper" by the specification, just as would happen in a
> standard SQL join. 1365 is related to 894, neither of which are fixed. I
> originally wrote my join fetch queries with no DISTINCT until I ran into
> 894. Now with DISTINCT and join fetches I don't get duplicates. Can you give
> an example of a query and what it returns (and what you'd like it to
> return)?
> 
Hello Daryl,

You state, that you're query with distinct and join fetch does work properly. 
But this would
mean OpenJPA-1365 doesn't occur, does it?
In our case we've got the problem when selecting from an N-M-relationship like:
class A {
  Set<B> bs;
  ...
}
class B {
  Set<A> as;
  ...
}
When we call "select a from A a join fetch B" we get n instances of A, with n = 
numbers of
A-B-associations.

kind regards,
Michael

Reply via email to