NullPointerException when Query.list()
--------------------------------------
Key: HSEARCH-48
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-48
Project: Hibernate Search
Issue Type: Bug
Components: query
Environment: Linux, Oracle/MySQL
Reporter: Eddie Man
Priority: Critical
Attachments: screenshot21.png
Suppose I have the following mapping:
ClassA
=======
<class name="ClassA" table="TableA" lazy="false">
<id name="ID" column="ID" type="integer"
unsaved-value="0">
<generator class="native">
</generator>
</id>
<one-to-one name="classB" class="ClassB"
cascade="save-update,lock" property-ref="classA"
lazy="no-proxy" access="field"/>
</class>
ClassB
=======
<class name="ClassB" table="TableB" lazy="false">
<composite-id>
<key-property name="ID" column="ID"
type="integer"/>
<key-many-to-one name="classA" column="ClassAID"
class="ClassA">
</key-many-to-one>
</composite-id>
</class>
Pre-condition :
TableA
+----+
| ID |
+----+
| 1 |
+----+
TableB
+----+----------+
| ID | ClassAID |
+----+----------+
| 1 | 1 |
+----+----------+
When I use Session.createQuery("From ClassA as ClassA").list(), it throw the
following exception:
java.lang.NullPointerException
at
org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1641)
at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:608)
at org.hibernate.type.EntityType.resolve(EntityType.java:382)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:116)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:842)
at org.hibernate.loader.Loader.doQuery(Loader.java:717)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1123)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira