[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4482) certain forms of HQL generate errors if your package names contain a sql reserved word

Karl Palsson (JIRA) noreply at atlassian.com
Thu Oct 8 12:59:41 EDT 2009


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

Karl Palsson commented on HHH-4482:
-----------------------------------

Another error: The query "update Radcheck r set r.attribute = 'InactivePassword' where r.userName ='" + userName + "'"

Gives the error

 ERROR [org.hibernate.hql.PARSER:main]    - <line 1:8: unexpected token: is>

java.lang.IllegalArgumentException: node to traverse cannot be null!
	at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:55)
	at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:280)
	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
	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)

> certain forms of HQL generate errors if your package names contain a sql reserved word
> --------------------------------------------------------------------------------------
>
>                 Key: HHH-4482
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4482
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-hql
>    Affects Versions: 3.2.6, 3.3.2
>         Environment: oracle and hsqldb, tested both 3.3.2GA and 3.2.6GA
>            Reporter: Karl Palsson
>
> The following queries generates the invalid sql below, if your java package name starts with a sql reserved word, but work just fine if they don't.
> session.createQuery("delete Usergroup where userName = :userName")...
> session.createQuery("delete Usergroup u where u.userName = :userName")
> The following sql is generated  "delete is.vf.nip.provision.handlers.radius.entities.Usergroup where userName = :userName" which fails with the message: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: is near line 1, column 8
> If you change the query to "delete from Usergroup where userName = :userName" you get more normal looking sql like, "delete from usergroup where UserName=?"
> All of these forms worked when my packages didn't start with "is"  I've tried to use the ClassicQueryTranslator, but my settings don't seem to take hold for that.
> I can work around this by changing the queries, but my package names should have no bearing on generated sql :(
> This is probably the same as: HHH-3213

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