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(QueryImpl.java:350) ~[org.eclipse.persistence.jpa-2.5.0.jar:na]
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1107) ~[org.eclipse.persistence.jpa-2.5.0.jar:na]
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1127) ~[org.eclipse.persistence.jpa-2.5.0.jar:na]
	at com.ifp.vault.data.util.DataEntityManager.getEntityByNamedQuery(DataEntityManager.java:112) ~[classes/:na]
	at com.ifp.vault.client.aa.data.inject.dao.DataInjectDAO.setEntertainmentConfiguration(DataInjectDAO.java:256) ~[classes/:na]
	at com.ifp.vault.client.aa.data.inject.dao.DataInjectDAO.importData(DataInjectDAO.java:177) ~[classes/:na]
	at com.ifp.vault.client.aa.data.inject.impl.DataInjectControllerImpl.run(DataInjectControllerImpl.java:87) ~[classes/:na]
	at com.ifp.vault.client.aa.data.inject.impl.DataInjectControllerImplTest.testRun(DataInjectControllerImplTest.java:49) [test-classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_12-ea]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_12-ea]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_12-ea]
	at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_12-ea]
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) [junit-4.10.jar:na]
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-4.10.jar:na]
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) [junit-4.10.jar:na]
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit-4.10.jar:na]
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) [junit-4.10.jar:na]
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) [junit-4.10.jar:na]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) [junit-4.10.jar:na]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [junit-4.10.jar:na]
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [junit-4.10.jar:na]
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) [.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) [.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) [.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) [.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) [.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: Mon Dec 22 07:57:41 GMT 2014

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

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