Hi, actual osgi jpa spec is a bit limited. I suggest you take a look at OSGi Compendium - JPA Service Specification. page 733
> 1. > > A Persistence Bundle is a normal bundle; it must follow all the rules > of OSGi and can use all OSGi constructs like Bundle-Classpath, fragment > bundles, import packages, export packages, etc. *However, there is one > limitation: any entity classes must originate in the bundle’s JAR, it > cannot come from a fragment*. This requirement is necessary to > simplify enhancing entity classes. > > regards, Cristiano 2012/11/12 Michiel Vermandel <[email protected]> > Thanks Bengt. > > Indeed I do hope that someone can shed some more light on this topic. > Any help is greatly appreciated. > > Michiel > > > > ----------------- > http://www.codessentials.com - Your essential software, for free! > Follow us at http://twitter.com/#!/Codessentials > ------------------------------ > *From:* Bengt Rodehav <[email protected]> > *To:* "[email protected]" <[email protected]>; Michiel Vermandel < > [email protected]> > *Sent:* Friday, November 9, 2012 3:22 PM > *Subject:* Re: Fw: Aries JPA modular design > > I'm also very interested in how to build modular applications using JPA. > Not sure if that is an Aries issue or (in my case) an OpenJPA issue. I > don't find JPA itself very supportive of this concept: > > The persistence.xml mixes concerns that have to do with the actual > database settings (not the URL but the configuration of OpenJPA e g what > dictionary to use) with concerns regarding the domain model. I want to > isolate database settings to a separate bundle altogheter. I would then > like different bundles to add OpenJPA enhanced classes working against this > database (that is defined somewhere else). To me JPA seems slightly > monolithic in its design. This shows very clearly when using an OSGi > runtime. > > Also, I use annotations in my persistent domain classes. However, it's do > to this in a database type independent way. I can't really switch from > Derby to SQLServer without actually changing the source code. I would like > this to be a runtimer decision and have my code support both options (e g > by having multiple versions of the annotation and some kind of qualifier > that can be specified in runtime). > > Another related issue is how to distinguish between simple > out-of-contiainer unit tests and in-container integration tests. They need > different perstence.xml. What is the recommendation regarding this? In what > bundle should the persistence.xml bu put? The data source bunde (should > only be one)? The domain classes bundle (several)? Its own bundle? The > integration test bundle? > > Hope you get some good replies because modularity is an extremely > important subject when using OSGi. > > /Bengt > > > > > 2012/11/9 Michiel Vermandel <[email protected]> > > Hi, > > Does anyone have an idea? > > Thanks > > ----------------- > http://www.codessentials.com - Your essential software, for free! > Follow us at http://twitter.com/#!/Codessentials > ----- Forwarded Message ----- > *From:* Michiel Vermandel <[email protected]> > *To:* "[email protected]" <[email protected]> > *Sent:* Monday, November 5, 2012 2:22 PM > *Subject:* Aries JPA modular design > > Hi, > > Despite many posts that touch this issue more or less it is still not > clear to me if it is possible to create a modular model with Aries JPA. > (modular = multiple bundles with own entities and persistence.xml that may > have referential dependencies) > > Let's say I want to make an application to manage contacts. > > Assumtions : All data resides in one database(!). > > The application has one required bundle: > Contacts - provides all usual data about contacts (for example name, > email, phone-number) > > Is it possible to have a second bundle (that can be provided as a optional > extension to the application) which contains communication information with > the contacts? > This bundle would contain its own Entities (CommunicationEntry,...) (and > persistence.xml) which refer to a contact. > > The Application thus must be runnable with or without the second bundle. > > Thanks, > > Michiel Vermandel > > ----------------- > http://www.codessentials.com - Your essential software, for free! > Follow us at http://twitter.com/#!/Codessentials > > > > > > -- "Tudo vale a pena se a alma não é pequena..."
