Annotated Hibernate Entity can not have a Bean property as ID (literal id)
--------------------------------------------------------------------------
Key: HHH-5787
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5787
Project: Hibernate Core
Issue Type: Bug
Components: annotations
Affects Versions: 3.5.6
Environment: Hibernate 3.5.3 final, with hsql as database
Reporter: yaodonghu
Priority: Minor
Attachments: FirstExample.java, SimpleAnnotation.java
the annotated entity has property name as "id", but it is not a identity
property.
When using hibernate to create a simple query again the entity as
"Select MyEntity_Alias from MyEntity MyEntity_Alias"
Then the hibernate give out the following exception:
java.lang.NullPointerException
null
at org.hibernate.util.StringHelper.root(StringHelper.java:260)
at
org.hibernate.persister.entity.AbstractEntityPersister.getSubclassPropertyTableNumber(AbstractEntityPersister.java:1467)
at
org.hibernate.persister.entity.BasicEntityPropertyMapping.toColumns(BasicEntityPropertyMapping.java:62)
at
org.hibernate.persister.entity.AbstractEntityPersister.toColumns(AbstractEntityPersister.java:1443)
at org.hibernate.hql.ast.tree.FromElement.getIdentityColumn(FromElement.java:345)
at org.hibernate.hql.ast.tree.IdentNode.resolveAsAlias(IdentNode.java:154)
at org.hibernate.hql.ast.tree.IdentNode.resolve(IdentNode.java:100)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:117)
at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:113)
at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:867)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.propertyRef(HqlSqlBaseWalker.java:1199)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2047)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:1983)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1515)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:586)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:294)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:237)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
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:98)
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:1760)
at roseindia.tutorial.hibernate.FirstExample.main(FirstExample.java:47)
Step to reproduce
Using the attach Annotated entity bean file SimpleAnnotation.java
and run the FirstExample.java (both file are attached)
--
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