Hibernate version: 3.2.0GA
Mapping documents: none annotations being used
Full stack trace of any exception that occurs:
Code:
Caused by: javax.ejb.EJBException: java.lang.NullPointerException
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:181)
at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
at $Proxy123.queryStructure(Unknown Source)
at XXX.queryData(MetadataTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
... 29 more
Caused by: java.lang.NullPointerException
at org.hibernate.hql.ast.tree.FromClause.findIntendedAliasedFromElementBasedOnCrazyJPARequirements(FromClause.java:120)
at org.hibernate.hql.ast.tree.FromClause.containsClassAlias(FromClause.java:247)
at org.hibernate.hql.ast.tree.FromClause.isFromElementAlias(FromClause.java:135)
at org.hibernate.hql.ast.HqlSqlWalker.isNonQualifiedPropertyRef(HqlSqlWalker.java:474)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.addrExpr(HqlSqlBaseWalker.java:4382)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1212)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3528)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1690)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:92)
at org.jboss.ejb3.entity.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:127)
at XXX.queryStructure(MetaTestBean.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
Name and version of the database you are using: PostgreSQL 8.1.4The generated SQL (show_sql=true):With version 3.2.0GA no SQL is printed out as the exception occurs before then.
The same query that works with 3.2.0CR2 is:
Code:
select distinct expression2_.id as id19_0_, restrictio4_.id as id19_1_, expression5_.id as id20_2_, targetenti6_.id as id21_3_, expression2_.type as type19_0_, expression2_.description as descript4_19_0_, expression2_.expr as expr19_0_, expression2_.DISCRIMINATOR as DISCRIMI1_19_0_, restrictio4_.type as type19_1_, restrictio4_.description as descript4_19_1_, restrictio4_.expr as expr19_1_, restrictio3_.expressionhierarchy_id as expressi1_0__, restrictio3_.restrictions_id as restrict2_0__, restrictio3_.rule_index as rule3_0__, expression5_.expression_id as expression3_20_2_, expression5_.role as role20_2_, expression5_.targetEntity_id as targetEn4_20_2_, expression5_.expression_id as expression3_1__, expression5_.id as id1__, targetenti6_.clazz as clazz21_3_, targetenti6_.attrName as attrName21_3_, targetenti6_.pk as pk21_3_ from TargetEntity targetenti0_ inner join ExpressionTarget expression1_ on targetenti0_.id=expression1_.targetEntity_id left outer join expressionhierarchy expression2_ on expression1_.expression_id=expression2_.id left outer join expressionhierarchy_expressionhierarchy restrictio3_ on expression2_.id=restrictio3_.expressionhierarchy_id left outer join expressionhierarchy restrictio4_ on restrictio3_.restrictions_id=restrictio4_.id inner join ExpressionTarget expression5_ on restrictio4_.id=expression5_.expression_id inner join TargetEntity targetenti6_ on expression5_.targetEntity_id=targetenti6_.id where targetenti0_.id=? and expression2_.DISCRIMINATOR='rule
From the following java code
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 downloaded 3.2.0GA yestrerday but it seems to have a problem with a query that worked perfectly well with 3.2.0CR2. I don't even know what the problem is as the exception raised is cryptic, but could it be something to do with the fact that there is a cylcle in the query ??
Or possibly i have not migrated from 3.2.0CR2 correctly, i just built everything (EntityManager, Annotation, and Core) and replace the hibernate3.jar, hibernate-annotations.jar, and hibernate-entitymanager.jar in the lib directory of the server, and hibernate-annotations.jar and hibernate-client.jar in the client directory. Is this the correct way to migrate, if not can you please point me to a url, as i could not find one.
Is this a bug in 3.2.0GA or is it a bug in 3.2.0CR2 that let this qery work in the first place ??
Thanks in advance,
Andy