I found that the JDBC connection is obtainable from OpenJPA
OpenJPAEntityManager kem = OpenJPAPersistence.cast(em);
Connection conn = (Connection) kem.getConnection();
however I am coding up an implementation-agnostic testing framework using JUnit4
and JPA, and I'd like to be able to obtain the connection from the JPA API.
The framework is designed to create a schema, insert clean test data and if
desired, clean up afterwards. It also has the facility to manage test data
stored in the XML, via DbUnit, so it's something that is intended to be highly
useful.
Is there a possibility that this may be added in the future?
The work-around is to abstract the connection retrieval code into interfaces and
establish a configuration option to handle it, but if this is appearing in the
JPA API in the next year or so, I could just hard-code it for now.
Thanks
Adam