Hi Tim,
A third application in Apache Karaf sends messages (with Apache Camel)
to consume for customers, so i think all bundles should be in the same
instance, and yes, i know all databases at build time.
I use your second option (Sample blog of Apache Aries), but i need
several DataSource.
Damien
Le 06/12/11 12:49, Timothy Ward a écrit :
Hi Damien,
Will all of these customers need to run in the same OSGi framework,
and do you know what all of the databases are at build time? I can
think of two possible options, but they might not fit with your usage
pattern:
1. Define multiple persistence units in your persistence bundle (a
persistence xml can contain lots of persistence unit elements).
Each customer application can use their own persistence unit to
access the database. This will work as long as the customers use
the EntityManagerFactory/EntityManager directly.
2. Define one persistence unit that looks up a Datasource as an OSGi
service. The customer specific bundle supplies the datasource as a
service, and can configure it to point at the right database. This
works if you only ever have one customer bundle in the framework
at a time.
If you're interested in a broader explanation of using OSGi
persistence bundles then I can recommend looking at the Apache Aries
documentation. There's also good coverage of JPA and OSGi in the third
chapter of Enterprise OSGi in Action (http://www.manning.com/cummins).
You can get 37% off the book if you use the code *eosgi37 *on the
manning website.
Regards,
Tim Ward
-------------------
Apache Aries PMC member & Enterprise OSGi advocate
Enterprise OSGi in Action (http://www.manning.com/cummins)
-------------------
------------------------------------------------------------------------
Date: Tue, 6 Dec 2011 08:59:24 +0100
From: [email protected]
To: [email protected]
Subject: Re: Multiple database for one OSGI/JPA bundle
Hi Matt,
Sorry, my English is very bad, It's difficult for me to explain my
problem.
My Application consists of two bundle :
- a bundle specific for each customer
- a bundle for persistence, same for every customer (same api, same
implementation)
But each customer has its own database, so each customer has its own
persistence unit. I don't known how to attach multiple persistence
unit to one bundle. i use OpenJPA and Apache Aries for persistence.
I will test it with a fragment containing a persistence unit.
Thanks
Damien
Le 06/12/11 03:48, Matt Madhavan a écrit :
Hi Damien,
Do not quite understand your exact req! Can you please explain a
bit more?
Sounds link you may solve your issue with OSGi fragments! But mean
while pl explain your req a bit more!
Thanks
Matt
On Dec 5, 2011 6:31 AM, "Damien Fontaine" <[email protected]
<mailto:[email protected]>> wrote:
Hi !
I have a little problem with my architecture on Apache
Aries/Karaf. I hope to post in the right place.
My project is composed of one OSGI/JPA bundle and one database
per customer but i want several customers on my instance
Apache Karaf. So, how to have one OSGI bundle for several
databases ? Or one OSGI bundle per database ?
Thanks,
Damien