Skip to main content



      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] Thu, 23 August 2012 21:45 Go to next message
Eclipse UserFriend
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

((JpaEntityManager)em.getDelegate()).getSession().getQueries()

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 09:55 Go to previous messageGo to next message
Eclipse UserFriend
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 10:42 Go to previous message
Eclipse UserFriend
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).

"eclipselink.session.include.descriptor.queries"="true"
Previous Topic:Thread hang in ConcurrencyManager.acquire()
Next Topic:Dynamic EclipseLink JPA Clarification
Goto Forum:
  


Current Time: Tue Jul 22 22:36:27 EDT 2025

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

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

Back to the top