Q:

HQL with parameters NoSuchMethodError

I am sure I am overlooking something obvious
the following static query works fine
hqlQuery = "select user from User as user where user.id = 'userid' ";

but when I parametrize the query
hqlQuery = "select user from User as user where user.id = :me ";
Query query = session.createQuery(hqlQuery);

I get a nasty stack dump from building the query.
What am I overlooking?
Exception in thread "main" java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
at org.hibernate.hql.ast.HqlSqlWalker.generateNamedParameter(HqlSqlWalker.java:940)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.parameter(HqlSqlBaseWalker.java:4997)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1413)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4471)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3947)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:2047)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:831)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:617)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
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:124)
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:1770)

A:

Problem here is there is a conflict between the two ANT jar files(namely: antlr-2.7.6.jar from Hibernate Jar library & antlr-2.7.2 from struts-1.3) in your project. This appears to be a peculiar problem with Struts-1.3 & Hibernate applications.
Please remove antlr-2.7.2.jar from your project(/WEB-INF/lib folder)& it should work fine.. Let me know if it works..

A:

Looks like you mixed incompatible versions of Hibernate jars (probably ANTLR jar has a wrong version).

