When a persistence unit is undeploy, the osgiClassLoader keep the class of this persistence unit
Description
Activity

Nicolas Ottaviani April 17, 2014 at 8:24 PM
Thanks for the answer, i haven't seen this part in the doc . I have changed the behavior of the OsgiPersistenceProviderService with a little reflection. When a bundle unget the service, i remove the class loader of this bundle and i don't have this problem. But if you think hibernate-core may need some work to handle this as well, I may be a little more investigating on the durability of my choice
Thanks

Brett Meyer April 14, 2014 at 1:40 PM
, excellent point. It's one that is already fairly well known. In our docs, we state:
The environment should be considered STATIC. Hibernate currently does not support the ability to dynamically add and remove client bundles during runtime. Doing so is typically catastrophic. We hope to better support at least partially-dynamic environments in Hibernate 5.
It's something that I'll definitely work towards, but this may not be limited to hibernate-osgi's OsgiClassLoader. Although I haven't really played with it yet, I'm assuming that hibernate-core itself may need some significant work to handle this as well. But, we'll see. Thanks

Nicolas Ottaviani April 11, 2014 at 1:44 PM
Sorry, keep all the classes (and not only one class . So all the entities are in the classLoader.
Details
Details
Assignee

Reporter

When we deploy a bundle with a persistenceUnit, the OsgiPersistenceProviderService add the bundle to the OsgiClassLoader but when the bundle is undeploy, the OsgiClassLoader is not cleared and the bundle is not removed.
So if we try to redeploy the same bundle, we have an "java.lang.IllegalArgumentException: Not an managed type" because the cache contains the old class in the classloader