[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2187) bad query results exposes IllegalArgumentException instead of an HibernateException

Bill Brown (JIRA) noreply at atlassian.com
Sat Apr 28 21:21:04 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_26824 ] 

Bill Brown commented on HHH-2187:
---------------------------------

Greetings:

I get the exace sam error message with this hiberante query.  I should not that I am using Spring to convifgure hibernate:

return (String)sessionFactory.getCurrentSession()
        .createQuery("song.author from Song song where song.label= ? and song.artist = ? and song.title = ?")
        .setString(0,label)
        .setString(1,artist)
        .setString(2,title)
        .uniqueResult(); 

here is the trace:

java.lang.IllegalArgumentException: node to traverse cannot be null!
        at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:31)
        at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:254)
        at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
        at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
        at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
        at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
        at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
        at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
        ...
        at java.lang.Thread.run(Thread.java:595)

Do you know why this happens?



> bad query results exposes IllegalArgumentException instead of an HibernateException
> -----------------------------------------------------------------------------------
>
>                 Key: HHH-2187
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2187
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: query-hql
>            Reporter: Max Rydahl Andersen
>
> s.createQuery("kkk");
> results in an IllegalArgumentException being thrown making the exception bubble
> through the expected catch HibernateException clauses in e.g. the tools.
> Cause is:
> public void traverseDepthFirst(AST ast) {
> 		if ( ast == null ) {
> 			throw new IllegalArgumentException( "node to traverse cannot be null!" );
> 		}
> 		visitDepthFirst( ast.getFirstChild() );
> 	}
> in NodeTraverser.
> java.lang.IllegalArgumentException: node to traverse cannot be null!
> 	at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:31)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:254)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
> 	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
> 	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
> 	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
> 	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
> 	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
> 	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
> 	at org.hibernate.console.HQLQueryPage.setSession(HQLQueryPage.java:103)
> 	at org.hibernate.console.ConsoleConfiguration$3.execute(ConsoleConfiguration.java:309)
> 	at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
> 	at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:304)
> 	at org.hibernate.eclipse.hqleditor.HQLEditor.executeQuery(HQLEditor.java:374)
> 	at org.hibernate.eclipse.console.actions.ExecuteQueryAction.execute(ExecuteQueryAction.java:72)
> 	at org.hibernate.eclipse.console.actions.ExecuteQueryAction.run(ExecuteQueryAction.java:52)
> 	

-- 
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