I defined a Filter on one entity and referenced it within a @Where Annotation. Like this:
@Entity @FilterDefs(value = { @FilterDef(name = "filterX", parameters = @ParamDef(type = "java.lang.String", name = "x")) }
) @Where(clause = "name=:filterX.x") public class Antragsteller extends UUID implements Serializable {
furthermore i defined a namedQuery in orm.xml:
<named-query name="Antragsteller.GetAll"> <query><![CDATA[SELECT a FROM Antragsteller a]]></query> </named-query>
It seems that Hibernate fails on preparing the namedQuery on Serverstartup. Take a look in the log:
08:36:45,126 DEBUG [org.hibernate.hql.internal.ast.ErrorCounter] (ServerService Thread Pool – 62) throwQueryException() : no errors 08:36:45,126 DEBUG [org.hibernate.hql.internal.antlr.HqlSqlBaseWalker] (ServerService Thread Pool – 62) select << begin [level=1, statement=select] 08:36:45,126 DEBUG [org.hibernate.hql.internal.ast.tree.FromElement] (ServerService Thread Pool – 62) FromClause {level=1} : entity.Antragsteller (a) -> antragstel0_ 08:36:45,126 DEBUG [org.hibernate.hql.internal.ast.tree.FromReferenceNode] (ServerService Thread Pool – 62) Resolved : a -> antragstel0_.uuid 08:36:45,126 DEBUG [org.hibernate.hql.internal.antlr.HqlSqlBaseWalker] (ServerService Thread Pool – 62) select : finishing up [level=1, statement=select] 08:36:45,126 DEBUG [org.hibernate.hql.internal.ast.HqlSqlWalker] (ServerService Thread Pool – 62) processQuery() : ( SELECT ( {select clause} antragstel0_.uuid ) ( FromClause{level=1}
Antragsteller antragstel0_ ) ) 08:36:45,126 DEBUG [org.hibernate.hql.internal.ast.util.JoinProcessor] (ServerService Thread Pool – 62) Using FROM fragment [Antragsteller antragstel0_] 08:36:45,126 DEBUG [org.hibernate.hql.internal.ast.util.SyntheticAndFactory] (ServerService Thread Pool – 62) Using unprocessed WHERE-fragment [( antragstel0_.name=:filterX.x)] 08:36:45,126 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool – 62) MSC00001: Failed to start service jboss.persistenceunit."JPA_Example.ear#JPA_ExamplePersistance": org.jboss.msc.service.StartException in service jboss.persistenceunit."JPA_Example.ear#JPA_ExamplePersistance": java.lang.NullPointerException at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25] at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25] at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final.jar:2.1.0.Final] Caused by: java.lang.NullPointerException at org.hibernate.hql.internal.ast.util.JoinProcessor.processDynamicFilterParameters(JoinProcessor.java:225) at org.hibernate.hql.internal.ast.util.SyntheticAndFactory.addWhereFragment(SyntheticAndFactory.java:117) at org.hibernate.hql.internal.ast.util.JoinProcessor.addJoinNodes(JoinProcessor.java:183) at org.hibernate.hql.internal.ast.util.JoinProcessor.processJoins(JoinProcessor.java:147) at org.hibernate.hql.internal.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:655) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:663) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:299) at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:247) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:248) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:1071) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:519) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1742) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
|