persistence@glassfish.java.net

RE: SQLException running EJBQL query selecting association field

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Mon, 31 Oct 2005 14:34:57 -0500

Hello Michael,
        I am not familliar enough with your changes to the EJBQL parser to point out what is causing this issue but I can explain why this error is occuring within TopLink.
        The Reference Class has been set to Order on the query but the reference class should be Customer. I think the old parser code used to evaluate the path expressions to determine what the real target type is. (ie Order.customer is really selecting customers).
        
--Gordon

-----Original Message-----
From: Michael Bouschen [mailto:Michael.Bouschen_at_Sun.COM]
Sent: Monday, October 31, 2005 9:11 AM
To: Tom Ware
Cc: persistence_at_glassfish.dev.java.net
Subject: SQLException running EJBQL query selecting association field


Hi Tom,

I run into a problem with an EJBQL query selecting an association field:

EJBQL: SELECT o.customer FROM Order o
SQL: SELECT CMP3_ORDER.ORDER_ID, CMP3_ORDER.SHIP_ADDR,
               CMP3_ORDER.CREATION_DATE, CMP3_ORDER.TOTAL_PRICE,
               CMP3_ORDER.ORDER_VERSION, CMP3_ORDER.QUANTITY,
               CMP3_ORDER.ITEM_ID, CMP3_ORDER.CUST_ID
        FROM CMP3_CUSTOMER t0, CMP3_ORDER t1
        WHERE (t0.CUST_ID (+) = t1.CUST_ID)
Running the above query on a Oracle database results in a SQLException:
ORA-00904: "CMP3_ORDER"."CUST_ID": invalid identifier.

Any idea?

I filed an glassfish issue and assigned to you:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=67

Regards Michael