Forums Register Login

Hibernate Query Language issue-Please help.

+Pie Number of slices to send: Send

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)
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Try this...

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

it works fine..
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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 ]
+Pie Number of slices to send: Send
 

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 ]
+Pie Number of slices to send: Send
 

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
She'll be back. I'm just gonna wait here. With this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3238 times.
Similar Threads
Hibernate Query Exception
Problem of Unknown Entity
delete query in hibernate giving error as null, and not deleting the record
Hibernate - Query Exception
Error in Hibernate
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 00:06:51.