[jboss-user] [EJB 3.0] - QuerySyntaxException
lafr
do-not-reply at jboss.com
Mon Sep 17 19:20:39 EDT 2007
On the way migrating a EJB 2.1 App to EJB 3.0 I got a problem with an EJB-QL query:
SELECT OBJECT(k)
FROM MbiFesta AS k, IN( k.mbiFekvw ) AS v
WHERE k.tstNr = ?1 AND k.varId = ?2
AND v.verwTabelle = 1 AND v.afCompNr = ?3 AND v.afLfdNr = ?4 AND v.afPosNr = ?5
As a result I get:
javax.ejb.EJBException: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: v near lin
e 1, column 80 [SELECT k FROM biz.mbisoftware.fn.ejb.entity.MbiFesta AS k, IN( k.mbiFekvw ) AS v WHERE k.tstNr = ?1 AND k.varId = ?2
AND v.verwTabelle = 1 AND v.afCompNr = ?3 AND v.afLfdNr = ?4 AND v.afPosNr = ?5]
Why is this not legal?
I also tried JOIN instead of IN, but got a similar exception: (unexpected token JOIN):
FROM MbiFesta AS k, JOIN k.mbiFekvw AS v
After spending much time to test different versions the following version works:
SELECT DISTINCT k
FROM MbiFesta AS k, MbiFekvw AS v
WHERE k.festaSerial = v.festaSerial
AND k.tstNr = ?1 AND k.varId = ?2
AND v.verwTabelle = 1 AND v.afCompNr = ?3 AND v.afLfdNr = ?4 AND v.afPosNr = ?5
But I'd like to understand why before searching and modifying other queries.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085287#4085287
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085287
More information about the jboss-user
mailing list