|Using EclipseLink in OSGi with Gemini JPA. Two questions. [message #871493]
||Mon, 14 May 2012 04:39
| GianMaria Romanato
Registered: July 2009
I am developing an OSGi application that will be deployed in Virgo Tomcat Server.
Persistence is implemented using EclipseLink and the database connections are instantiated via Gemini JPA and a custom DBAccess for PostgreSQL.
I noticed that even if org.osgi.service.jdbc.DataSourceFactory offers methods to create a DataSource and a ConnectionPoolDataSource, EclipseLink/Gemini is always calling createDriver(Properties) and is wrapping the driver instance within a DataSource of its own to create connections.
Is it right to assume that in such a configuration the pooling will be provided by EclipseLink itself? If true, can someone confirm that pooling must be configured via EclipseLink properties such as
I understand that the OSGi bluprint specification dictates that each persistence unit should be packaged in its own bundle. I see the advantages of this approach (i.e. maximum modularity, each unity may use different connection parameters etc), but at the same time, this may be not optimal if all the persistence units in a large application must be connected to the same database, because in such case, assuming that pooling is enabled, you would have several different pools of connections to the same database.
Is there a way to overcome this limitation other than packaging all of the units in the same OSGi bundle and merging their persistence.xml files?
For example, I read that EclipseLink supports composite units. Are they usable also in an OSGi environment together with Gemini JPA? Alternatively, is there a way to tell EclipseLink to merge all pools with equal connections parameters?
Thanks a lot.