• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate Query Language issue-Please help.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 162
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
permaculture is largely about replacing oil with people. And one tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic