|Using same PersistenceUnit across bundles [message #909080]
||Thu, 06 September 2012 09:52
| Patrick Heinzelmann
Registered: August 2012
Currently, I'm separating an application into multiple bundles, because some bundles (core services like user management, ... ) should be used as common bundles across multiple projects.|
The project is using Hibernate as persistence framework.
As Virgo can't scan for class annotated with @Entity, I had to add the xml for the persistence unit and the definition of EntityManagerFactory into the app bundle. Now, I have the problem that the EntityManagerFactory isn't available inside this common bundles.
Is there a way that, I can create and use a persistenceunit across bundles or would it be possible to expose the EntityManagerFactory of the app bundle as OSGI service for the core bundles.
Not sure if the second approach of exposing as OSGI service would work from a bundle lifecycle perspective?
Does anyone have a solution if the entities and the daos are distributed across bundles?