-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: HQL Query exception: expecting IDENT, found ...
PostPosted: Wed May 31, 2006 10:54 am 
Newbie

Joined: Sun Dec 12, 2004 11:16 am
Posts: 2
Hibernate version: 3.0.5

Try to execute a HQL query DELETE com.bmc.idm.ctsa.hb8.dbobject.UserGroup where (attached_group_subEntity = :0 and attached_group_id = :1 )
reciving the following exception. Can anyone point me to what I am doing wrong?

Full stack trace of any exception that occurs:
org.hibernate.hql.ast.QuerySyntaxError: expecting IDENT, found '0' near line 1, column 83 [DELETE com.bmc.idm.ctsa.hb8.dbobject.UserGroup where (attached_group_subEntity = :0 and attached_group_id = :1 )]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:215)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:865)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)


Name and version of the database you are using: Oracle 9.2

Debug level Hibernate log excerpt:
2006-05-31 17:41:07,601 DEBUG [main] org.hibernate.hql.ast.QueryTranslatorImpl - parse() - HQL: DELETE com.bmc.idm.ctsa.hb8.dbobject.UserGroup where (attached_group_subEntity = :0 and attached_group_id = :1 )
2006-05-31 17:41:07,631 ERROR [main] org.hibernate.hql.PARSER - *** ERROR: line 1:83: expecting IDENT, found '0'
2006-05-31 17:41:07,631 DEBUG [main] org.hibernate.hql.ast.ErrorCounter - line 1:83: expecting IDENT, found '0'
line 1:83: expecting IDENT, found '0'
at antlr.Parser.match(Parser.java:211)
at org.hibernate.hql.antlr.HqlBaseParser.identifier(HqlBaseParser.java:461)
at org.hibernate.hql.antlr.HqlBaseParser.primaryExpression(HqlBaseParser.java:3355)
at org.hibernate.hql.antlr.HqlBaseParser.atom(HqlBaseParser.java:3031)
at org.hibernate.hql.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:2806)
at org.hibernate.hql.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:2687)
at org.hibernate.hql.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2407)
at org.hibernate.hql.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:481)
at org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2195)
at org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2150)
at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2020)
at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:1937)
at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:1901)
at org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:1663)
at org.hibernate.hql.antlr.HqlBaseParser.expressionOrVector(HqlBaseParser.java:3980)
at org.hibernate.hql.antlr.HqlBaseParser.primaryExpression(HqlBaseParser.java:3394)
at org.hibernate.hql.antlr.HqlBaseParser.atom(HqlBaseParser.java:3031)
at org.hibernate.hql.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:2806)
at org.hibernate.hql.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:2687)
at org.hibernate.hql.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2407)
at org.hibernate.hql.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:481)
at org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2195)
at org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2057)
at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2020)
at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:1937)
at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:1901)
at org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:1663)
at org.hibernate.hql.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1834)
at org.hibernate.hql.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:376)
at org.hibernate.hql.antlr.HqlBaseParser.deleteStatement(HqlBaseParser.java:232)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:139)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:209)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:865)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
at com.bmc.idm.ctsa.hb8.query.HB8ExecuteQuery.execute(HB8ExecuteQuery.java:47)
at com.bmc.idm.ctsa.datalayer.datasource.dbh.DBSetImpl.delete(DBSetImpl.java:622)
at com.bmc.idm.ctsa.datalayer.datasource.BaseAssociationImpl.detach(BaseAssociationImpl.java:283)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.findAllAssociatedParents2PK(SetServiceBean.java:435)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.doDisconnectFromAssociations(SetServiceBean.java:347)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.handleAssociations(SetServiceBean.java:268)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.delete(SetServiceBean.java:237)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.delete(SetServiceBean.java:190)
at com.bmc.idm.ctsa.test.entities.tree.TestTree.testGetChildren(TestTree.java:461)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:58)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:98)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
2006-05-31 17:41:07,661 ERROR [main] org.hibernate.hql.PARSER - *** ERROR: line 1:111: expecting IDENT, found '1'
2006-05-31 17:41:07,661 DEBUG [main] org.hibernate.hql.ast.ErrorCounter - line 1:111: expecting IDENT, found '1'
line 1:111: expecting IDENT, found '1'
at antlr.Parser.match(Parser.java:211)
at org.hibernate.hql.antlr.HqlBaseParser.identifier(HqlBaseParser.java:461)
at org.hibernate.hql.antlr.HqlBaseParser.primaryExpression(HqlBaseParser.java:3355)
at org.hibernate.hql.antlr.HqlBaseParser.atom(HqlBaseParser.java:3031)
at org.hibernate.hql.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:2806)
at org.hibernate.hql.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:2687)
at org.hibernate.hql.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2407)
at org.hibernate.hql.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:481)
at org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2195)
at org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2150)
at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2020)
at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:1947)
at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:1901)
at org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:1663)
at org.hibernate.hql.antlr.HqlBaseParser.expressionOrVector(HqlBaseParser.java:3980)
at org.hibernate.hql.antlr.HqlBaseParser.primaryExpression(HqlBaseParser.java:3394)
at org.hibernate.hql.antlr.HqlBaseParser.atom(HqlBaseParser.java:3031)
at org.hibernate.hql.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:2806)
at org.hibernate.hql.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:2687)
at org.hibernate.hql.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2407)
at org.hibernate.hql.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:481)
at org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2195)
at org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2057)
at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2020)
at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:1937)
at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:1901)
at org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:1663)
at org.hibernate.hql.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1834)
at org.hibernate.hql.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:376)
at org.hibernate.hql.antlr.HqlBaseParser.deleteStatement(HqlBaseParser.java:232)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:139)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:209)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:865)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:89)
at com.bmc.idm.ctsa.hb8.query.HB8ExecuteQuery.execute(HB8ExecuteQuery.java:47)
at com.bmc.idm.ctsa.datalayer.datasource.dbh.DBSetImpl.delete(DBSetImpl.java:622)
at com.bmc.idm.ctsa.datalayer.datasource.BaseAssociationImpl.detach(BaseAssociationImpl.java:283)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.findAllAssociatedParents2PK(SetServiceBean.java:435)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.doDisconnectFromAssociations(SetServiceBean.java:347)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.handleAssociations(SetServiceBean.java:268)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.delete(SetServiceBean.java:237)
at com.bmc.idm.ids.dal.ejb.SetServiceBean.delete(SetServiceBean.java:190)
at com.bmc.idm.ctsa.test.entities.tree.TestTree.testGetChildren(TestTree.java:461)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at com.intellij.rt.execution.junit2.IdeaJUnitAgent.doRun(IdeaJUnitAgent.java:58)
at junit.textui.TestRunner.start(TestRunner.java:172)
at com.intellij.rt.execution.junit.TextTestRunner2.startRunnerWithArgs(TextTestRunner2.java:23)
at com.intellij.rt.execution.junit2.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:98)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
2006-05-31 17:41:07,701 DEBUG [main] org.hibernate.hql.ast.AST - --- HQL AST ---
\-[DELETE] 'DELETE'
+-[FROM] 'FROM'
| \-[RANGE] 'RANGE'
| \-[DOT] '.'
| +-[DOT] '.'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[DOT] '.'
| | | | | +-[DOT] '.'
| | | | | | +-[IDENT] 'com'
| | | | | | \-[IDENT] 'bmc'
| | | | | \-[IDENT] 'idm'
| | | | \-[IDENT] 'ctsa'
| | | \-[IDENT] 'hb8'
| | \-[IDENT] 'dbobject'
| \-[IDENT] 'UserGroup'
\-[WHERE] 'where'
\-[AND] 'and'
+-[EQ] '='
| \-[IDENT] 'attached_group_subEntity'
\-[EQ] '='
\-[IDENT] 'attached_group_id'


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 11:04 am 
Beginner
Beginner

Joined: Tue May 30, 2006 6:03 am
Posts: 20
Location: London
er.. you only use the : for params that you then specify outside. try without the ':'


Top
 Profile  
 
 Post subject: Using parms
PostPosted: Wed May 31, 2006 11:14 am 
Newbie

Joined: Sun Dec 12, 2004 11:16 am
Posts: 2
I am using parms. Since my code is auto generating the HQL I use :0, :1 ... to define the parm names a bit out of the standard but it works with other HQL queries.

I set the parameter on the query before I try and execute it.

Looking at the Query class, member actualNamedParameters has the values [0, 1] and the member namedParameters has the values {0=static-group-db, 1=214}.

It look to me OK.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 11:49 am 
Beginner
Beginner

Joined: Tue May 30, 2006 6:03 am
Posts: 20
Location: London
what is the full java code you are using to generate this? and have you used param names of 0 and 1 elsewhere in your code or is this the first time?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.