Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Using same PersistenceUnit across bundles
Using same PersistenceUnit across bundles [message #909080] Thu, 06 September 2012 13:52 Go to next message
Patrick Heinzelmann is currently offline Patrick HeinzelmannFriend
Messages: 2
Registered: August 2012
Junior Member
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?


Re: Using same PersistenceUnit across bundles [message #912546 is a reply to message #909080] Thu, 13 September 2012 18:48 Go to previous message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 123
Registered: January 2012
Senior Member
Hi Patrick. Is possible. Howover, I strongly recommends that you use Eclipse Gemini JPA and Eclipselink to that.
Eclipse Gemini JPA implements the OSGi JPA Enterprise specification, and hardcodes EclipseLink as backend. You can add Gemini JPA on Virgo.

When you start a bundle with a META-INF/persistence.xml (or other location mapped on MANIFEST.MF), it creates and EMF and publish it on the OSGI registry, using your entity bundle as provider. You can get it where you need. Your domain entities of course, will be acessible too.

Please, see:
Previous Topic:update to 3.5.0 failed
Next Topic:Spring 3.2 without OSGi meta-data?
Goto Forum:

Current Time: Mon Sep 21 11:10:52 GMT 2020

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

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

Back to the top