Need connection object used by EntityManager [message #1012600] |
Thu, 21 February 2013 16:32  |
Eclipse User |
|
|
|
I am using EclipseLink under WebLogic 12c. I need to get access to the underlying java.sql.Connection object being used by the EntityManager in an EJB. I'm not going to waste time going into the reasons for this, I know most people will think it's not necessary, but I need that connection. I found the following example at http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager
entityManager.getTransaction().begin();
java.sql.Connection connection = entityManager.unwrap(java.sql.Connection.class);
...
entityManager.getTransaction().commit();
But this does not work, I get null returned from the call to entityManager.unwrap(java.sql.Connection.class);
Is there another way to get the connection?
Thanks for any help!
|
|
|
|
Powered by
FUDForum. Page generated in 0.08434 seconds