RaceRegistration.executeQuery("select RaceRegistration.compositeEvent.id FROM RaceRegistration where RaceRegistration.id in :registrationIds group by RaceRegistration.compositeEvent.id",
[registrationIds: [1,2]])
在上面的查询中,我的疑问在最后一部分[registrationIds:[1,2]]。在这里,我假设列表的格式是错误的。我感谢任何纠正格式的帮助。谢谢!
我收到以下异常
Exception thrown
org.springframework.orm.hibernate3.HibernateQueryException: Unable to resolve path [RaceRegistration.compositeEvent], unexpected token [RaceRegistration] [select RaceRegistration.compositeEvent.id FROM com.runnercard.registration.RaceRegistration where RaceRegistration.id in :registrationIds group by RaceRegistration.compositeEvent.id]; nested exception is org.hibernate.QueryException: Unable to resolve path [RaceRegistration.compositeEvent], unexpected token [RaceRegistration] [select RaceRegistration.compositeEvent.id FROM com.runnercard.registration.RaceRegistration where RaceRegistration.id in :registrationIds group by RaceRegistration.compositeEvent.id]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:656)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343)
at com.runnercard.registration.RaceRegistration.executeQuery(RaceRegistration.groovy)
at com.runnercard.registration.RaceRegistration$executeQuery.call(Unknown Source)
at ConsoleScript5.run(ConsoleScript5:4)
Caused by: org.hibernate.QueryException: Unable to resolve path [RaceRegistration.compositeEvent], unexpected token [RaceRegistration] [select RaceRegistration.compositeEvent.id FROM com.runnercard.registration.RaceRegistration where RaceRegistration.id in :registrationIds group by RaceRegistration.compositeEvent.id]
at org.hibernate.hql.ast.tree.IdentNode.resolveAsNakedComponentPropertyRefLHS(IdentNode.java:219)
at org.hibernate.hql.ast.tree.IdentNode.resolve(IdentNode.java:108)
at org.hibernate.hql.ast.tree.DotNode.resolveFirstChild(DotNode.java:175)
at org.hibernate.hql.ast.HqlSqlWalker.lookupProperty(HqlSqlWalker.java:576)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.propertyRef(HqlSqlBaseWalker.java:1181)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.propertyRefLhs(HqlSqlBaseWalker.java:5495)