-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: NullPointerException on HqlSqlWalker.createFromJoinElement
PostPosted: Thu Sep 11, 2008 4:27 pm 
Newbie

Joined: Thu Sep 11, 2008 3:42 pm
Posts: 1
I am getting a NPE on executing query using joins -

Mapping:-
------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

<class name="com.xx.apps.xpmkz.datalayer.XPMKZData" table="XPMKZ">
<composite-id name="XPMKZID" class="com.xx.apps.xpmkz.datalayer.XPMKZID">
<key-property name="CPN"
column="CPN"/>
<key-property name="Type"
column="TYPE"/>
<key-property name="Station"
column="STATION"/>
<key-property name="Sublocation"
column="SUBLOCATION"/>
</composite-id>
<property name="Value" type="int" column="VALUE"/>
<property name="UpdateDate" type="timestamp" column="UPDATE_DATE"/>
<property name="SentDate" type="timestamp" column="SENT_DATE"/>
<property name="SentStatus" type="int" column="SENT_STATUS"/>
</class>

</hibernate-mapping>
------------------------------------------------------------------------------------

Query String -
------------------------------------------------------------------------------------

"select t1, t2 " +
"from XPMKZData as t1 " +
"left join fetch com.xx.apps.xpmkz.datalayer.XPMKZData as t2 " +
"where t1.XPMKZID.CPN = t2.XPMKZID.CPN " +
"and t1.XPMKZID.Station = t2.XPMKZID.Station " +
"and t1.XPMKZID.Sublocation = t2.XPMKZID.Sublocation " +
"and t1.XPMKZID.Station=? " +
"and t1.XPMKZID.Sublocation=? ";
------------------------------------------------------------------------------------


HSQL -
------------------------------------------------------------------------------------

select t1, t2 from com.xx.apps.xpmkz.datalayer.XPMKZData as t1 left join fetch com.xx.apps.xpmkz.datalayer.XPMKZData as t2 where t1.XPMKZID.CPN = t2.XPMKZID.CPN and t1.XPMKZID.Station = t2.XPMKZID.Station and t1.XPMKZID.Sublocation = t2.XPMKZID.Sublocation and t1.XPMKZID.Station=? and t1.XPMKZID.Sublocation=?
------------------------------------------------------------------------------------

Exception
------------------------------------------------------------------------------------

java.lang.NullPointerException
at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:332)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3275)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3067)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
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:251)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1650)
at com.xx.apps.xpmkz.dbservices.XPMKZDao.getSublocationMKZrecords(XPMKZDao.java:155)
at tests.com.xx.apps.xpmkz.dbservices.XPMKZDaoTest.testGetSublocationRecords(XPMKZDaoTest.java:116)
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:324)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

------------------------------------------------------------------------------------


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.