Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Obtaining Instance of Connection from EM
Obtaining Instance of Connection from EM [message #538073] Fri, 04 June 2010 16:28 Go to next message
Mauro Flores is currently offline Mauro Flores
Messages: 84
Registered: September 2009
Location: Brasil
Member
Is there a way to obtaing the instance of java.sql.Connection being used by an instance of EntityManager?

Thanks, Mauro.
Re: Obtaining Instance of Connection from EM [message #538474 is a reply to message #538073] Mon, 07 June 2010 12:58 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

In JPA 2.0 you can use,

entityManager.unwrap(java.sql.Connection.class)

Previously you could access the connection from the DatabaseAccessor of the EntityManager's Session.


James : Wiki : Book : Blog : Twitter
Previous Topic:Query across Variable One to One mapping
Next Topic:HistoryPolicy: INSERT Error with missing fields
Goto Forum:
  


Current Time: Thu Aug 21 22:09:11 EDT 2014

Powered by FUDForum. Page generated in 0.04053 seconds