persistence@glassfish.java.net

JPQL: fix NPE for COUNT on variable joining a ManyToMany self-ref relationship

From: Michael Bouschen <Michael.Bouschen_at_Sun.COM>
Date: Mon, 12 Mar 2007 18:59:54 +0100

Hi Tom,

attached you find my change to fix the NPE in
SQLSelectStatement.appendFromClauseForOuterJoin when doing a COUNT on a
variable that joins a ManyToMany self referencing relationship. I think
the issue was that the old code could not distinguish source and target
table, because they are the same for a ManyToMany self referencing
relationship. I changed this to make use of the table aliases, since
they are different.

You find the fix and a new test case in the attachment. Please have a
look. Thanks!

Regards Michael