|EntityManager can't find entities with URLClassLoader [message #664415]
||Fri, 08 April 2011 17:56
| John Borland
Registered: April 2011
I have a rather unusual situation, my apologies if this has been covered elsewhere. I was unable to find anyone with the same problem.|
I am using EclipseLink in the context of LiveConnect, which allows Firefox extensions to run Java code. This involves creating a URLClassLoader to load jars into LiveConnect.
I am able to create an EntityManager, but it can't see any of the entities. In other words, when I call EntityManagerFactory.getMetamodel().getEntities(), it is empty. When I run the same code with the same database, persistence.xml, etc, outside of the firefox context, the entities are all there. I have all of the entities explicitly listed in persistence.xml in both situations.
My hunch is that this has something to do with the URLClassLoader, but I am kind of stumped beyond that. The URLClassLoader I am using has no problem loading the entity classes. I tried specifying entity mappings in orm.xml instead, but then EclipseLink complains about not being able to find the class.
Is there a way to add entities directly to the EntityManager with an existing class object? I was not able to find one. I am looking for some mechanism where I can say to the EntityManager, "here is the entity that you seek!" but I have not found a way to do so.
I am using:
Eclipse Helios Service Release 2, Build id: 20110301-1815
EclipseLink 2.1.x (as it is shown in eclipse, this includes:
Thanks for any advice... I can put together a minimal demo app that shows the problem if anyone is intrigued but has no immediate suggestions.
Powered by FUDForum
. Page generated in 0.01973 seconds