[jboss-user] [EJB 3.0] - Re: totally weird error: org.hibernate.hql.ast.tree.FromClau
andydale
do-not-reply at jboss.com
Mon Oct 23 06:54:59 EDT 2006
I also had this problem after upgrading to the latest release of Hibernate (3.2.0GA). I was experiencing the this exception when trying query a single table inheritence structure.
The following query did not work
| Query tmpQuery = mEntityManager.createQuery("SELECT DISTINCT e.expression FROM TargetEntity " +
| "t INNER JOIN t.expressionTargets e LEFT OUTER JOIN FETCH e.expression.restrictions r " +
| "JOIN FETCH r.expressionTargets f JOIN FETCH f.targetEntity " +
| "WHERE t.id = :pk AND e.expression.class = Rule").setParameter("pk", 1);
|
but the following one did
| Query tmpQuery = mEntityManager.createQuery("SELECT DISTINCT e.expression FROM TargetEntity " +
| "t INNER JOIN t.expressionTargets e LEFT OUTER JOIN FETCH e.expression.restrictions r " +
| "JOIN FETCH r.expressionTargets f JOIN FETCH f.targetEntity " +
| "WHERE t.id = :pk AND e.expression.class = 'rule'").setParameter("pk", 1);
|
I had to quote the discriminator value in the query, if this was not done it caused a NPE.
Cheers,
Andy
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3979988#3979988
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3979988
More information about the jboss-user
mailing list