Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » getAcessor() method undefined for UnitOfWork.
getAcessor() method undefined for UnitOfWork. [message #789017] Thu, 02 February 2012 13:57 Go to next message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
Accoding to this wiki

http://wiki.eclipse.org/EclipseLink/Examples/JPA/EMAPI#Getting_a_JDBC_Connection_from_an_EntityManager

This is a possible way to obtain a JDBC connection with Eclipselink 2.0.2:

entityManager.getTransaction().begin();
UnitOfWork unitOfWork = (UnitOfWork)((JpaEntityManager)entityManager.getDelegate()).getActiveSession();
unitOfWork.beginEarlyTransaction();
Accessor accessor = unitOfWork.getAccessor();
accessor.incrementCallCount(unitOfWork.getParent());
accessor.decrementCallCount();
java.sql.Connection connection = accessor.getConnection();

However, my IDE compains that the getAcessor() method is undefined for UnitOfWork.

Tom
Re: getAcessor() method undefined for UnitOfWork. [message #789018 is a reply to message #789017] Thu, 02 February 2012 13:58 Go to previous message
Tom Eugelink is currently offline Tom Eugelink
Messages: 807
Registered: July 2009
Senior Member
> UnitOfWork unitOfWork = (UnitOfWork)((JpaEntityManager)entityManager.getDelegate()).getActiveSession();

Casting to UnitOfWorkImpl will work however.

Tom
Previous Topic:Custom MetadataSource and Dynamic Weaving
Next Topic:NoSQL
Goto Forum:
  


Current Time: Sun Sep 21 16:22:28 GMT 2014

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

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