jQuery in Action, 2nd edition*
The moose likes Object Relational Mapping and the fly likes error: method createQuery in interface EntityManager cannot be applied to given types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "error: method createQuery in interface EntityManager cannot be applied to given types" Watch "error: method createQuery in interface EntityManager cannot be applied to given types" New topic
Author

error: method createQuery in interface EntityManager cannot be applied to given types

Simon Joseph Aquilina
Ranch Hand

Joined: Feb 14, 2006
Posts: 102
Hello when I try to make use of javax.persistence.TypedQuery I get the error "method createQuery in interface EntityManager cannot be applied to given types". If I make use of javax.persistence.Query I do not get the error (but obviously I have to stay typecasting the result to the wanted object). I did a search on the internet and I found out that this might be a problem with dependencies. I use maven to manage my builds. My original dependencies where as follows:



On the internet I read that TypedQuery where introduced for JPA 2.0 and that I should have used the hibernate stub project for JPA 2.0, i.e.



This did not work either. So I searched for OpenJPA JPA 2.0 library and tried to set this as a dependency, i.e. -



This did not work either! So I was wondering has anyone encountered this problem and actually managed to solve it?
I still get the same error and I cannot understand why!

Note that the error is very strange as it does not fail on the import of javax.persistence.TypedQuery but when I call the createQuery method!



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error: method createQuery in interface EntityManager cannot be applied to given types