Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » NamedQuery of name ... not found.
NamedQuery of name ... not found. [message #1061905] Tue, 04 June 2013 15:40 Go to next message
Rob V is currently offline Rob VFriend
Messages: 1
Registered: June 2013
Junior Member
My persistence.xml has multiple persistence units. I'm acquiring the EntityManagerFactory and EntityManager for my PU. When running my unit test in Eclipse Juno (normal JUnit test) sometimes it works sometimes returns an error as below:

[EL Info]: 2013-06-04 16:29:47.705--ServerSession(1618732380)--EclipseLink, version: Eclipse Persistence Services - 2.5.0.v20130507-3faac2b
[EL Info]: connection: 2013-06-04 16:29:53.243--ServerSession(1618732380)--file:... login successful
16:29:54.827 [main] ERROR c.i.v.c.a.d.i.i.DataInjectControllerImpl
java.lang.IllegalArgumentException: NamedQuery of name: Country.getCountryByIso2Code not found.
	at org.eclipse.persistence.internal.jpa.QueryImpl.getDatabaseQueryInternal( ~[org.eclipse.persistence.jpa-2.5.0.jar:na]
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery( ~[org.eclipse.persistence.jpa-2.5.0.jar:na]
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery( ~[org.eclipse.persistence.jpa-2.5.0.jar:na]
	at ~[classes/:na]
	at ~[classes/:na]
	at ~[classes/:na]
	at ~[classes/:na]
	at [test-classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_12-ea]
	at sun.reflect.NativeMethodAccessorImpl.invoke( ~[na:1.7.0_12-ea]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[na:1.7.0_12-ea]
	at java.lang.reflect.Method.invoke( ~[na:1.7.0_12-ea]
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( [junit-4.10.jar:na]
	at [junit-4.10.jar:na]
	at org.junit.runners.model.FrameworkMethod.invokeExplosively( [junit-4.10.jar:na]
	at org.junit.internal.runners.statements.InvokeMethod.evaluate( [junit-4.10.jar:na]
	at org.junit.internal.runners.statements.RunBefores.evaluate( [junit-4.10.jar:na]
	at org.junit.internal.runners.statements.RunAfters.evaluate( [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner.runLeaf( [junit-4.10.jar:na]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild( [junit-4.10.jar:na]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild( [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner$ [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner$1.schedule( [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner.runChildren( [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner.access$000( [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner$2.evaluate( [junit-4.10.jar:na]
	at [junit-4.10.jar:na]
	at [.cp/:na]
	at [.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( [.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests( [.cp/:na]
	at [.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main( [.cp/:na]
[EL Info]: connection: 2013-06-04 16:29:54.831--ServerSession(1618732380)--file:... logout successful

I'm using EclipseLink 2.5 and MySQL database in a virtual machine.

Is it something to do with weaving maybe? Again, sometimes it works, sometimes not, really strange.

Any help appreciated.
Re: NamedQuery of name ... not found. [message #1062958 is a reply to message #1061905] Tue, 11 June 2013 14:21 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Ensure that you have defined the named query with the correct name, ensure you have compiled/redeployed your code, set logging to finest and check your log for any errors that may have occurred during deployment.

James : Wiki : Book : Blog : Twitter
Previous Topic:JMS cache coordination on GlassFish cluster
Next Topic:JPQL problems with JOIN FETCH on List<Entity>
Goto Forum:

Current Time: Fri May 25 17:01:55 GMT 2018

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

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

Back to the top