Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Query Language issue-Please help.

 
Amit Bhat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

where Users is a simple java bean mapped to the table (users) in MySQL.

Whenever I call the function containing the line,
I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException
at org.hibernate.hql.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:27)
at org.hibernate.impl.SessionFactoryImpl.createQueryTranslators(SessionFactoryImpl.java:357)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:423)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at client.TestClient.getUsersByAge(TestClient.java:84)
at client.TestClient.findByAge(TestClient.java:88)
at client.TestClient.main(TestClient.java:110)
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you are missing some of the jar files Hibernate relies on. Have a read of the tutorial, it lists what jars you need.
 
Amardeep Salkar
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this...

String qq = "select id from dual";
Query qur = session.CreateSQLQuery(qq);
qur.executeUpdate();

it works fine..
 
Amit Bhat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following jars in my classpath:
ant-antlr-1.6.3.jar
asm.jar
asm-attrs.jar
cglib-2.1.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
dom4j-1.6.jar
jta.jar
log4j-1.2.8.jar
hibernate3.jar
hsqldb.jar
mysql-connector-java-3.1.14-bin.jar

Do I need anyother jar?
These jars were mentioned in the hibernate tutorial.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amardeep Salkar:
Try this...

String qq = "select id from dual";
Query qur = session.CreateSQLQuery(qq);
qur.executeUpdate();

it works fine..


Its not a good idea to run Hibernate without using HQL! How do you run the above against SQL Server?
[ August 08, 2008: Message edited by: Paul Sturrock ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amit Bhat:
I have the following jars in my classpath:
ant-antlr-1.6.3.jar
asm.jar
asm-attrs.jar
cglib-2.1.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
dom4j-1.6.jar
jta.jar
log4j-1.2.8.jar
hibernate3.jar
hsqldb.jar
mysql-connector-java-3.1.14-bin.jar

Do I need anyother jar?
These jars were mentioned in the hibernate tutorial.


You don't have antlr in your classpath (first jar mentioned in the tutorial). The missing class comes from this.
[ August 08, 2008: Message edited by: Paul Sturrock ]
 
Kuladip Yadav
Ranch Hand
Posts: 162
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amit Bhat:
I have the following jars in my classpath:
ant-antlr-1.6.3.jar
asm.jar
asm-attrs.jar
cglib-2.1.jar
commons-collections-2.1.1.jar
commons-logging-1.0.4.jar
dom4j-1.6.jar
jta.jar
log4j-1.2.8.jar
hibernate3.jar
hsqldb.jar
mysql-connector-java-3.1.14-bin.jar

Do I need anyother jar?
These jars were mentioned in the hibernate tutorial.


You have to include antlr-2.7.6.jar (version may chaged)
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic