我有三个表AB和C.现在我想在HQL执行此SQL查询:
select * from A as a
left join
B as b
on
a.id = b.id
left join
C as c
on
b.type=c.type;
需要以书面形式等同HQL帮助。 我试着用这个的HQL ...
Query q = session.createQuery(
"FROM A as a
LEFT JOIN
B as b
on
a.id=b.id
LEFT JOIN
C as c
on
b.type=c.type");
此查询引发异常.....
org.hibernate.hql.ast.QuerySyntaxError:意外的标记:邻近线1 LEFT,柱23 FROM com.admin.A作为LEFT JOIN B为b,其中a.Id = b.Id LEFT将C为c,其中b。类型=在org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:214)在org.hibernate.hql c.type]在org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:74) .ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)在org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)在org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
我也试图与“同”和“关于”的条款,而不是在那里......我得到同样的意外的标记“上”或“与”
例外qith ON .....
org.hibernate.hql.ast.QuerySyntaxError:意外的标记:ON邻近线1,列41 [FROM com.admin.A作为LEFT JOIN B为b上a.Id = b.Id LEFT JOIN C作为Çonb.type =上org.hibernate.hql c.type]在org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:74)在org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:214)。 ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)在org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)在org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
我也试图与“同”的条款,而不是在那里......我得到同样意外的标记或“具有”
与例外qith .....
org.hibernate.hql.ast.QuerySyntaxError:意外的标记:ON邻近线1,列41 [FROM com.admin.A作为LEFT JOIN B为b上a.Id = b.Id LEFT JOIN C作为Çonb.type =上org.hibernate.hql c.type]在org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:74)在org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:214)。 ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)在org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)在org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
请帮忙。