-->
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.  [ 4 posts ] 
Author Message
 Post subject: Select List - NullPointerException
PostPosted: Sat Aug 20, 2005 4:54 am 
Newbie

Joined: Sat Aug 20, 2005 4:33 am
Posts: 3
Hibernate version:
3.0.3 & 3.1 beta 1(cvs)
Mapping documents:
<class name="hb.Cat" table="CAT">
<id name="id" type="string" unsaved-value="null" >
<column name="CAT_ID" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>
<list name="SomeList" lazy="false" table="CATLIST">
<key column="CAT_ID_LIST" not-null="true"/>
<list-index column="sortOrder"/>
<element column="VALUE" type="string" />
</list>
</class>
Code between sessionFactory.openSession() and session.close():
Query q = s.createQuery("select c.SomeList from Cat as c");
List lst = q.list();
Full stack trace of any exception that occurs:
testList(hb.ReturnListTest)
java.lang.NullPointerException
at org.hibernate.hql.ast.tree.FromElementType.renderIdentifierSelect(FromElementType.java:140)
at org.hibernate.hql.ast.tree.FromElement.renderIdentifierSelect(FromElement.java:166)
at org.hibernate.hql.ast.tree.SelectClause.renderNonScalarIdentifiers(SelectClause.java:375)
at org.hibernate.hql.ast.tree.SelectClause.renderNonScalarSelects(SelectClause.java:353)
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:195)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:596)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:463)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:633)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:269)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:217)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:211)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:153)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:100)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:459)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:901)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:851)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at hb.ReturnListTest.testList(ReturnListTest.java:17)
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 junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
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:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Name and version of the database you are using:
PostgreSQL 8.0.3
The generated SQL (show_sql=true):
none

How i may select SomeList otherwise?


Top
 Profile  
 
 Post subject: Try this
PostPosted: Sat Aug 20, 2005 9:02 pm 
Newbie

Joined: Thu Aug 18, 2005 3:22 am
Posts: 13
Did you try "select c.SomeList from Cat c" (without "as")?

Regards
Guido


Top
 Profile  
 
 Post subject: Re: Try this
PostPosted: Sat Aug 20, 2005 9:23 pm 
Newbie

Joined: Sat Aug 20, 2005 4:33 am
Posts: 3
glaures wrote:
Did you try "select c.SomeList from Cat c" (without "as")?

Yes. Result is the same:
testList(hb.ReturnListTest)
java.lang.NullPointerException
at org.hibernate.hql.ast.tree.FromElementType.renderIdentifierSelect(FromElementType.java:140)
at org.hibernate.hql.ast.tree.FromElement.renderIdentifierSelect(FromElement.java:166)
at org.hibernate.hql.ast.tree.SelectClause.renderNonScalarIdentifiers(SelectClause.java:375)
at org.hibernate.hql.ast.tree.SelectClause.renderNonScalarSelects(SelectClause.java:353)
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:195)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:596)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:463)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:633)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:269)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:217)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:211)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:153)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:100)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:459)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:901)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:851)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at hb.ReturnListTest.testList(ReturnListTest.java:17)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 20, 2005 10:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Collections cannot appear in the select clause. Refer to HQL examples in the docs.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.