We are using hibernate in our project. We have a query which requires a left outer join. The query is as follows :
How to know i am using JPQL or HQL while writing queries.
I have a scenario where i have to implement left outer join in the query.
So i have written 'with' along with left outer join keywords.
But i am getting following exception :
org.hibernate.queryexception unexpected token with [
I read that with is supported with HQL but not with JPQL. So I have 2 questions :
1) how to identify whether JPQL or HQL and which version is used in my project? 2) if 'with' is not supported in JPQL, then how to implement left outer join between two tables with a specific value of a property.
The query is as follows :
select v.vId,v.vName,cur.code,con.dxId from
vanTb v, regionTb r, currencyTb cur, connTb con
where
v.vNum = r.vNum
and v.vCode = r.vCode
and v.vId = cur.vId
and v.vId *= con.vId
and con.dlId = 1234 and v.status=1
*= -> left outer join in sybase ASE database.
And the named-query is as :
select v.vId,v.vName,cur.code,con.dxId from vanTb v inner join v.regionTb r inner join
v.currencyTb left outer join v.connTb con with con.dlId = :DlId where vendor.status = 1
Here regionTb, currencyTb and connTb and vanTb are name of entity beans and vanTb.java have regionTb, currencyTb and connTb as memeber variables.