|When is Gemini JPA ready to be used to add DynamicTypes via Eclipelink DynamicSchemaManager [message #1407697]
||Wed, 13 August 2014 08:40
| Dobias van Buuren
Registered: August 2014
I'm trying to migrate from EclipseLink 2.4.1 to 2.5.2 in an environment where we have built a persistence framework on top of EclipseLink.|
Since we have a truly dynamic system where the database schema contributions come from various bundles (read OSGi services that implement our Persistable interface) and can be modified at runtime via our product, we use the EclipseLink Dynamic Entities API to create org.eclipse.persistence.dynamic.DynamicType instances and add / replace it to the Schema using the org.eclipse.persistence.tools.schemaframework.DynamicSchemaManager.
Note that the only entries in the persistence.xml is a persistence-unit with some eclipselink properties configured. No class entries at all, because they are all contributed using the Dynamic Entity API.
All works fine with org.eclipse.persistence.jpa.osgi, because I know when the Eclipselink bundles are ready for use. I did this by depending on the service javax.persistence.EntityManagerFactory for my persistence unit (osgi.unit.name=MyUnit).
Since persistence.jpa.osgi has been superseded by org.eclipse.gemini.jpa, I started using this Gemini JPA (version 1.2.0 M1).
Because my PersistenceManagerImpl may only start processing Persistable services (discovered using whiteboard pattern) when EclipseLink / Gemini is finished with their initialization / weaving / etc. I am looking for a way to find this out. My first approach was roughly the same as with o.e.persistence.jpa.osgi: I created a dependency to the org.osgi.service.jpa.EntityManagerFactoryBuilder service for my persistence unit, but I found that this wasn't good enough.
The symptoms I have are that DynamicTypes added a little early aren't created in the underlying database, but when I wait some time, then DynamicTypes are added and everything works fine. All works fine also when I stop/ start the org.eclipse.gemini.jpa bundle when my system is completly running.
My question to the Gemini experts is: How do I find out that Gemini is finished with whatever it needs to do? Ideally, I want to be able to listen to some kind of org.osgi.service.Event to find out Gemini is ready / Gemini is busy.
Note that I have hot-deployment requirements, so every bundle (also the Gemini / EclipseLink ones) must be stopped, started at any order and my micro services based system must gracefully stop offering some services and start offering some services when its providing bundles are started again.
Thanks in advance for your replies.
Powered by FUDForum
. Page generated in 0.01515 seconds