persistence@glassfish.java.net

JPQL: fix invalid error message for embedded with property-based access (issue 2883)

From: Michael Bouschen <Michael.Bouschen_at_Sun.COM>
Date: Mon, 30 Apr 2007 16:50:50 +0200

Hi Tom,

attached you find my fix for issue 2883 "Query field of embedded class
causes jpql validation errors":
https://glassfish.dev.java.net/issues/show_bug.cgi?id=2883

I changed the use of descriptors inside the query validation phase. The
old code always used a class object to represent a type and used the
class object to look up the ClassDescriptor in the session. As I
understand, the ClassDescriptor as stored in the session for an
embeddable is onlya shell and does not hold all the information. Instead
I need to use the ClassDescriptor from the AggregateMapping of the
embedded field. The fix is to use the ClassDescriptor (instead of the
class object) as the type representation in case of an embedded
instance. Then there is no need to lookup the ClassDescriptor in the
session when analyzing a field access of the embedded.

You find the fix and a new test case attached. Please have a look.

Thanks!

Regards Michael