|Using JPA without publishing the persistence unit with Gemini JPA [message #1033868]
||Thu, 04 April 2013 18:36
| Jochen Seeber
Registered: April 2013
I am trying to create a "private" persistence unit in my bundle that I do not want published as a service. For this reason, I'm not using the "Meta-Persistence" element in my manifest, but trying to create the EntityManager the non-OSGi way:
EntityManager em = Persistence.createEntityManagerFactory("unit").createEntityManager();
However, since OSGi's JPA replaces the PersistenceProvider(Resolver) and only does a service lookup, the creation of the EntityManagerFactory fails.
My question now is: What is the right way in Gemini JPA to create a "private" EntityManagerFactory that is not exposed to other bundles, and use it in the bundle?
If this is not possible, how can I create an EntityManagerFactory using "Meta-Persistence" and use it in the same module (since the EMF is only registered by Gemini after the bundle was started).
[Updated on: Sat, 06 April 2013 17:50]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.02022 seconds