Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » [SOLVED] Entity Class identity problem in OSGi after uninstalling/reinstalling persistence bundle(Strange EclipseLink JPA error due to change of class identity because a persistence bundle gets uninstalled and then reinstalled)
[SOLVED] Entity Class identity problem in OSGi after uninstalling/reinstalling persistence bundle [message #891606] Mon, 25 June 2012 10:53 Go to next message
GianMaria Romanato is currently offline GianMaria RomanatoFriend
Messages: 72
Registered: July 2009
Member
Hi all,

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.
	org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entityEmbeddableManagedTypeNotFound(MetamodelImpl.java:174)
	org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entity(MetamodelImpl.java:194)
	org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.from(AbstractQueryImpl.java:97)	


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?

Thanks
Giamma.

[Updated on: Mon, 25 June 2012 11:25]

Report message to a moderator

Re: [SOLVED] Entity Class identity problem in OSGi after uninstalling/reinstalling persistence bundl [message #891625 is a reply to message #891606] Mon, 25 June 2012 11:25 Go to previous messageGo to next message
GianMaria Romanato is currently offline GianMaria RomanatoFriend
Messages: 72
Registered: July 2009
Member
Solved, the problem is not related to EclipseLink at all. Sorry.

Developing for Virgo using PDE: http://bit.ly/1w0tTit
Global JNDI in Virgo: http://bit.ly/1to42mn
Hyperic to monitor Virgo: http://bit.ly/W1Fst9
Profile Virgo with JProfiler http://bit.ly/1FBLGCw
Re: [SOLVED] Entity Class identity problem in OSGi after uninstalling/reinstalling persistence bundl [message #899067 is a reply to message #891625] Mon, 30 July 2012 13:00 Go to previous message
Stefan Buys is currently offline Stefan BuysFriend
Messages: 1
Registered: July 2012
Junior Member
Can you maybe specify what the cause was (as I am experiencing a similar issue using EclipseLink)?
Previous Topic:Search Query Error
Next Topic:Problem in Object Relational Mapping with @JoinColumn
Goto Forum:
  


Current Time: Tue Apr 23 10:15:26 GMT 2024

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

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

Back to the top