Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink Connection Pool Usage
Eclipselink Connection Pool Usage [message #1723037] Thu, 11 February 2016 08:28 Go to next message
Havard Kristiansen is currently offline Havard KristiansenFriend
Messages: 3
Registered: November 2015
Junior Member
I am attempting to create a JSF application running on WebLogic 12cR2, and I need to run a user specific database procedure call before any database operations can be executed.

Ideally, we would like to grab and keep one connection until the request is completed, so we only have to execute the database call once.

In the current version, EclipseLink grabs a connection from the pool for every fetch. Eclipselink has no clue of transactions in the current version, as we use JTA. We can minimize the number of fetches tuning each query, but as the application grows more complex, we would really like to have control over connection pool usage.

We are unsure how to go about this, and have tried a number of things; Open Session in View filter with UserTransaction, @PersistenceContext, CDI injection of @RequestScoped EntityManager, @Stateless EJB-beans, exclusive connections, but all to no avail. It is probably something fundamental we do not understand about JTA/Eclipselink.

I have included a small(ish) sample JSF-application to show the problem. It will run on a Weblogic 12CR1/R2 with a data source with jndi-name "jdbc.plainDS" against HR-schema with Employees/Departments table in an Oracle database. If you debug, you will see it grabs a connection when it fetches Employees for each Department.

We do not know how to go about minimizing connection pool usage.
Is JTA the way to go?
Isn't this a common requirement when using VPD?
Is connection pool a bad choice for this requirement?
How can we achieve minimal connection pool usage?

I do not know if Eclipselink forum is the right place for this question, but at this time, any suggestions or nudges in the right direction will be greatly appreciated!

Re: Eclipselink Connection Pool Usage [message #1723099 is a reply to message #1723037] Thu, 11 February 2016 15:24 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1380
Registered: July 2009
Senior Member
EclipseLink tries to be more efficient when configured to use a default read pool by releasing connections immediatley after a query is done so that fewer read connections can be shared among more threads. The code within a transaction operates the same.

What it seems like you want is to have the session underlying your context hold onto a single connection for its life, and only release it when it is closed. This is refered to as exclusive connection mode and can be configured as described here

EclipseLink also has additional VPD support described here

[Updated on: Thu, 11 February 2016 15:26]

Report message to a moderator

Previous Topic:A javax.persistence.NonUniqueResultException Problem with Criteria API
Next Topic:Using cache-coordination across different eclipselink version
Goto Forum:

Current Time: Sun Mar 07 06:36:41 GMT 2021

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

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

Back to the top