Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Using EclipseLink in OSGi with Gemini JPA. Two questions.(Two questions about pooling and connection sharing)
Using EclipseLink in OSGi with Gemini JPA. Two questions. [message #871493] Mon, 14 May 2012 08:39 Go to next message
GianMaria Romanato is currently offline GianMaria RomanatoFriend
Messages: 72
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.

First question
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*

Second question
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.

Developing for Virgo using PDE:
Global JNDI in Virgo:
Hyperic to monitor Virgo:
Profile Virgo with JProfiler
Re: Using EclipseLink in OSGi with Gemini JPA. Two questions. [message #871689 is a reply to message #871493] Mon, 14 May 2012 17:26 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
If you specify the jdbc.url property, you are telling EclipseLink to obtain connections directly from the driver/ConnectionManager. EclipseLink will then use its own internal connection pools, which can be configured using the properties described here:

Otherwise, you specify a datasource which EclipseLink will lookup from the context, which can be reused on the container.

If you want to use your own datasource, this blog has an example of passing one in:

As for pools, I would recommend you set one up per application anyway since you can tailor the settings on the applications requirements and usage paterns. This can be helpful as it is common to misconfigure and have one app starving others out for limited connection resources.

Best Regards,

[Updated on: Mon, 14 May 2012 17:27]

Report message to a moderator

Previous Topic:eclipselink programmatically generate persistentunit
Next Topic:JPQL Query List Parameter Exception
Goto Forum:

Current Time: Sun Jul 25 17:06:22 GMT 2021

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

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

Back to the top