Results 1 to 1 of 1
- 08-02-2010, 04:41 PM #1
Member
- Join Date
- Aug 2010
- Posts
- 1
- Rep Power
- 0
I need to extract a connection object from an entity manager
Good Morning,
i am trying to do what this text says:
Which is from this page:JPA 2.0
entityManager.getTransaction().begin();
java.sql.Connection connection = entityManager.unwrap(java.sql.Connection.class);
...
entityManager.getTransaction().commit();
JPA 1.0
entityManager.getTransaction().begin();
UnitOfWork unitOfWork = (UnitOfWork)((JpaEntityManager)entityManager.getDe legate()).getActiveSession();
unitOfWork.beginEarlyTransaction();
java.sql.Connection connection = unitOfWork.getAccessor().getConnection();
...
entityManager.getTransaction().commit();
EclipseLink/Examples/JPA/EMAPI - Eclipsepedia
But i can't understand what is that unitOfWork . Could somesone explain that?
I whould also like to know how to get the jpa version (though i believe mine is 1.0, once the unwrap method is not shown by eclipse).
Thanks in advance.
Similar Threads
-
Close connection object
By ersachinjain in forum JDBCReplies: 1Last Post: 05-30-2010, 12:30 AM -
PK for Entity beans
By eva in forum Enterprise JavaBeans (EJB)Replies: 3Last Post: 07-17-2008, 10:03 AM -
Getting warnings reported by Connection object
By Java Tip in forum Java TipReplies: 0Last Post: 01-20-2008, 08:57 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks