• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to locate HQL query plan in cache; generating (from Event)

 
Sudheer Arimbra
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am a newbee in Hibernate. I got an error "unable to locate HQL query plan in cache; generating (from Event)" when using the query "from event". Please find the code fragment below.


I have a java bean Event in event package. I am able to store the events in mysql database. Am I missing something?
 
Henrik Engert
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you include "antlr-2.7.6.jar" in your project it should work just fine.

I had the same problems, but fixed it with including the "antlr-2.7.6.jar" into my project.

I am using Hibernate 3.2, and in the Hibernate installation lib directory there are several *.jar files. First I included "ant-antlr-1.6.5.jar", and I got the same error as you.

BUT, the error you get is a side effect from it not finding the class definition. So the problem is NOT "unable to locate HQL query plan in..."

Look at all the errors you get:

09:07:02,011 DEBUG QueryPlanCache:70 - unable to locate HQL query plan in cache; generating (from Event)
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
.
.
.
Caused by: java.lang.reflect.InvocationTargetException
.
.
.
Caused by: java.lang.NoClassDefFoundError: antlr/ANTLRException
[ December 12, 2006: Message edited by: Henrik Engert ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another point: why are you wrapping your query in a transaction?
 
Henrik Engert
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The example he is showing is from the tutorial from the Hibernate website. It's a copy&paste, but that's just my guess.

+ you get this if you don't wrap it:

Exception in thread "main" org.hibernate.HibernateException: createQuery is not valid without active transaction
[ December 12, 2006: Message edited by: Henrik Engert ]
 
Halcon Guatemala
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to @ll, Sudheer, have You set your mapping resource through hibernate.cfg.xml or are you setting this in your code?

Thanks
 
xxe coderanch
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henrik Engert wrote:If you include "antlr-2.7.6.jar" in your project it should work just fine.

I had the same problems, but fixed it with including the "antlr-2.7.6.jar" into my project.

I am using Hibernate 3.2, and in the Hibernate installation lib directory there are several *.jar files. First I included "ant-antlr-1.6.5.jar", and I got the same error as you.

BUT, the error you get is a side effect from it not finding the class definition. So the problem is NOT "unable to locate HQL query plan in..."

Look at all the errors you get:

09:07:02,011 DEBUG QueryPlanCache:70 - unable to locate HQL query plan in cache; generating (from Event)
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
.
.
.
Caused by: java.lang.reflect.InvocationTargetException
.
.
.
Caused by: java.lang.NoClassDefFoundError: antlr/ANTLRException
[ December 12, 2006: Message edited by: Henrik Engert ]


thank you . it is.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic