|[SOLVED] Entity Class identity problem in OSGi after uninstalling/reinstalling persistence bundle [message #891606]
||Mon, 25 June 2012 06:53
| GianMaria Romanato
Registered: July 2009
I am prototyping an OSGi enterprise application with EclipseLink JPA (snapshot) and Gemini JPA. The prototype is deployed in Eclipse Virgo.
I have a persistence unit included in a bundle. When the app starts everything works fine and JPA works as expected.
If (with OSGi running) I uninstall and re-install the bundle containing the persistence unit (i.e. I am hot-swapping the bundle) and then I try to use again the EMFBuilder and the EMF to obtain an EM and to perform a search, I get the following error:
java.lang.IllegalArgumentException: No [EntityType] was found for the key class [model.Client] in the Metamodel - please verify that the [Entity] class was referenced in persistence.xml using a specific <class>model.Client</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.
I believe that EclipseLink closes the EMF when the bundle is uninstalled.
In fact, I am using a SynchronousBundleListener to listen to bundle events myself, and if in the listener I try to call EMF.close() I get an IllegalStateException that states that the factory is already closed.
After reinstalling the bundle containing the persistence unit I get the EMF from the builder, but the class descriptors in the MetamodelImpl do not match, i.e. the class objects used as keys of the field "entities" of type Map<Class, EntityTypeImpl<?>> in MetamodelImpl are not the same classes as those included in the reinstalled bundle. The classname is the same, but the hashcode does not match and when I try to use the ne EMF I get the above error.
Is there something special I should do to have EclipseLink reset and recreate the MetamodelImpl object?
[Updated on: Mon, 25 June 2012 07:25]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01504 seconds