[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [eclipselink-users] [OSGI] Using entity manager factory with entities discovered at runtime in an other bundle
- From: "Tim Hollosy" <hollosyt@xxxxxxxxx>
- Date: Thu, 24 Jul 2008 13:06:50 -0400
- Delivered-to: email@example.com
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Dx6EvOVFtrh8/RFOMmE2cYceC/e3K5d6mWg6sVRqzesrT/aO03Da3GfYjy2ZXFv6St bIPpF4hewDdAWU8VqXoZEt4cHy4kskCUCi/Xr5tQJJsn2XxGekHLG7kW2cuB6xhwKSbS 3DjbgjwU9VANPidXQ/mYf1tcubUEP7BRehkt0=
You've ran into the same problem that many of us (the few) who use osgi have.
Here's how we handle it: We expose the EntityManagerFactory in each
plugin, this way if another plugin wants to use it, it simply grabs
it, and uses it to do all the persistence.
The trick is you can't merge an Entity from one bundle into another
bundle. So in cases where you need to do a bunch of stuff in the same
transaction you must duplicate your entities in the other
plugins....not an ideal solution but it works.
Also if you're interested in the general architecture of an OSGi RCP
app we've made a sample application that's currently under review on
Let me know if you have any questions.
On Thu, Jul 24, 2008 at 9:27 AM, Guillaume PRIN
> I have built an OSGI bundle which can read and write annotated entities to a
> database inspired by the "OSGi Proof of Concept". Unfortunately, I can't
> a satisfactory solution for my problem. I would like to use this bundle to
> persist entities defined in other bundles. These bundles may be considered
> "plugins" of the first bundle, which is started at first. Plugins may be
> numerous, I cannot open as many database connections.
> My problem, is that in OSGI, without taking into account the problems of
> dependency, it seems that the entities must be defined in the
> and cannot be discovered at runtime when plugins register to the first
> And so the first bundle cannot persist entities from plugins.
> To use the factory, I thought the use of a OSGI service from the first
> eclipselink-users mailing list