Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » force the connection
force the connection [message #386069] Thu, 26 March 2009 09:37 Go to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 817
Registered: July 2009
Senior Member
At the moment I'm in the situation of migrating an application from direct-JDBC to Eclipselink JPA. Usually I can convert a subsystem, but this time I need to extend an alder piece of code and I would prefer to have the new logic be implemented in the BM using JPA. This would mean that my direct-JDBC code will use one connection and JPA another, which will create conflicts on several area's.

Is it possible to get the connection used by Eclipselink's transaction for writing, or is it possible to set that connection?
Re: force the connection [message #386071 is a reply to message #386069] Thu, 26 March 2009 14:47 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

If you use a JTA DataSource and both usages are in the same JTA
transaction. Then they will use the same connection. This is normally
the best way to do this.

You can also get the JDBC connection from EclipseLink using:

((JpaEntityManager)em.getDelegate()).getUnitOfWork().beginEa rlyTransaction();
((JpaEntityManager)em.getDelegate()).getUnitOfWork().getAcce ssor().getConnection();

---
James
http://www.nabble.com/EclipseLink---Users-f26658.html


James : Wiki : Book : Blog : Twitter
Previous Topic:Optimistic locking without EclipseLink dependency in my domain objects?
Next Topic:change then remove results in exception... why
Goto Forum:
  


Current Time: Fri Apr 19 00:23:33 GMT 2024

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

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

Back to the top