Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Named Query not found(Named query defined using deploy.xml not found by EntityManager)
Named Query not found [message #903502] Fri, 24 August 2012 01:45 Go to next message
Miguel Missing name is currently offline Miguel Missing nameFriend
Messages: 9
Registered: September 2010
Junior Member
I design all of my eclipselink 2.3 entities using Workbench. I created a named query using the workbench, but when calling createNamedQuery with my entity manager the query is not found. The query is defined in the deploy.xml descriptor, which is generated automatically by the workbench, and has very basic syntax to make troubleshooting easy. In fact, apparently no queries are present, I checked that using


and the count is 0, there should be two named queries defined.
Re: Named Query not found [message #904480 is a reply to message #903502] Tue, 28 August 2012 13:55 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1369
Registered: July 2009
Senior Member
Is the workbench creating a JPA project, persistence.xml and entities, or is it a native EclipseLink sessions.xml? Basically, what is the deploy.xml file, and how are you setting up the EntityManager and persistence.xml for using the session in JPA?
Re: Named Query not found [message #905003 is a reply to message #904480] Wed, 29 August 2012 14:42 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

In general you should not use the EclipseLink Mapping Workbench for JPA, it is for EclipseLink's native ORM. For JPA you should use tools such as EclipseLink JPA (Dali).

It is possible to use a sessions.xml generated by the EclipseLink Mapping Workbench, but this is more for backward compatibility for users migrating from the EclipseLink native ORM.
For the native ORM named queries are defined on the descriptor (per class), but for JPA they need to be defined on the Session, this may be why your query is not found.

There is a persistence unit property you can set to copy all of the descriptor queries to the session (you must ensure they have unique names).


James : Wiki : Book : Blog : Twitter
Previous Topic:Thread hang in ConcurrencyManager.acquire()
Next Topic:Dynamic EclipseLink JPA Clarification
Goto Forum:

Current Time: Wed Sep 23 03:24:10 GMT 2020

Powered by FUDForum. Page generated in 0.02026 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top