我正在尝试以这种方式在 HQL 中设置参数:
Query query = session.createQuery("from Device d " +
"left join fetch d.tradeInOldDevice " +
"left join fetch d.tradeInNewDevice " +
"left join fetch d.warranty " +
"where d.owningCompany.customerRefId =:customerId ");
query.setString("customerId", "someHardCodeCustomerId");
Set<Device> customerDevices= (Set<Device>) query.list();
我对这个错误感到困惑:
2013 年 2 月 24 日
2:36:02 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [ServicesServlet] in context with path [] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
at org.hibernate.hql.ast.HqlSqlWalker.generateNamedParameter(HqlSqlWalker.java:945)
休眠依赖:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.0.1.Final</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>3.6.10.Final</version>
</dependency>
我在 Spring 容器内的 tomcat 上运行休眠。
我在我的项目中检查了 Maven 依赖项,我有 Maven:antlr:antlr:2.7.2。
这里有什么问题?
谢谢。