Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Sharing EclipseLink Connection with legacy JDBC-code

I am acquiring the Connection in plain old Java SE style (own connection pool implementation).
One major question is:

EclipseLink calls at least two times close() on the Connection (at instantation of the EntityManager, and on commit()/rollback()).

Is it safe to wrap the real connection in a proxy object, just ignore the close() and always return the same Connection by the DataSource which is used within the EclipeLink session?

Patric

Zitat von Tim Hollosy <hollosyt@xxxxxxxxx>:

It would depend on how you're getting your connection. For example, I
know in spring you can share a Datasource with no problem as long as
the same Spring Transaction Manager manages the EntityManagerFactory
and the datasource.

./tch



On Mon, Aug 16, 2010 at 10:17 AM,  <patric@xxxxxxxxxx> wrote:

Hello everyone,

is it possible to share an EclipseLink Connection with a regular JDBC
Connection?

Imagine an application which consists of several JDBC queries/statements
inside one transaction.
I'd like to do some refactoring and replace some old JDBC code with JPA
using EclipseLink.

Is it possible that EclipseLink is using the same Connection as the legacy
JDBC code, so that it "sees" the uncommited data which have been made before
and that regular JDBC which will be executed afterwards can see the changed
data for EclipseLink?

(of course, the I have to call flush() the entitymanager)

If it's not possible - what would you suggest for such a refactoring?

Thank you!

Best regards,
Patric


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users







Back to the top