[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4589) HqlSqlWalker.createFromJoinElement throws java.lang.NullPointerException when join Embedded classes

Rodrigo Carvalho Rezende (JIRA) noreply at atlassian.com
Tue Nov 24 08:10:29 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34749#action_34749 ] 

Rodrigo Carvalho Rezende commented on HHH-4589:
-----------------------------------------------

Also, Why is it rejected? Maybe I wasn't clear before, sorry.
But I was not asking for the support for "embedded join" feature.
What I suppose to showed is that a query that was not reject by the parser was the cause of a Null pointer exception.
At javadoc of EntityManager, at @thows section:
    Throws: (...)  IllegalArgumentException - if query string is not valid

If my query string is not supported by hibernate, I think it is invalid and IllegalArgumentException would be the appropriate exception in this case. Null Pointer Exception sounds "ugly" for many users, since it is the result of a possible non checked precondition.

Thanks, Rodrigo.




> HqlSqlWalker.createFromJoinElement throws java.lang.NullPointerException when join Embedded classes
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HHH-4589
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4589
>             Project: Hibernate Core
>          Issue Type: New Feature
>          Components: query-hql
>    Affects Versions: 3.3.2
>         Environment: Hibernate 3.3.2.GA, Java 6 (Sun), Linux, Mysql 5
>            Reporter: Rodrigo Carvalho Rezende
>         Attachments: hb-hql-join-embedded-bug.tar.gz
>
>
> When I join a entity with a embedded class in HQL a null pointer exception is thrown.
> See the stack trace:
> Exception in thread "main" java.lang.NullPointerException
> 	at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:371)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3452)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3239)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3112)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:720)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:571)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:288)
> 	at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:231)
> 	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: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:1651)
> 	at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)
> 	at BugNullPointerException.main(BugNullPointerException.java:15)
> I've isolated the behavior in an attached JSE (eclipse) project to be reproducible (pls, create the "hb_hql_join_embedded_bug" database)
> Thanks, Rodrigo.

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list