Skip to Content
0
Former Member
Jul 21, 2008 at 10:16 AM

JPA and LEFT JOIN

1029 Views

I have a very basic question related to JPA.

I am using dict tables and connecting it to MaxDB.

In my Entity I have a select statement like this,

@NamedQuery  (name = "getOperations", query = "SELECT operT.id FROM SII_ARC_Oper operT " +
			"LEFT JOIN SII_ARC_Service serviceT " +
			"ON   operT.sid = serviceT.sid AND " +
			"serviceT.duuid =:duuid")

When I call this in my Bean, I get this error,

An error occurred processing the named query >>getOperations<< with the query string >>SELECT operT.id FROM SII_ARC_Oper operT LEFT JOIN SII_ARC_Service serviceT ON   operT.sid = serviceT.sid AND serviceT.duuid =:duuid<<. The exception text is: line 1: Variable 'SII_ARC_Service' not declared
SELECT operT.id FROM SII_ARC_Oper operT LEFT JOIN SII_ARC_Service serviceT ON   operT.sid = serviceT.sid AND serviceT.duuid =:duuid
                                                  ^
line 1: unexpected token: serviceT
SELECT operT.id FROM SII_ARC_Oper operT LEFT JOIN SII_ARC_Service serviceT ON   operT.sid = serviceT.sid AND serviceT.duuid =:duuid

I am just wondering how do I declare the u201CSII_ARC_Serviceu201D in my Entity before the Named Query. Or am I not declaring anything else..?

Thanks

Domnic

Edited by: domnic savio on Jul 21, 2008 12:16 PM