• 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

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

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!



 
reply
    Bookmark Topic Watch Topic
  • New Topic