If you are using JTA, your tx manager will take care of this for you.
That's the only spec-compliant way right now.

I'm sure that any decent implementation will have an apo for this, so
you might consider creating a class that you call to prform this and
other common extensions in a single location.

-Patrick

On 11/16/07, Adam Hardy <[EMAIL PROTECTED]> wrote:
>
> 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
>


-- 
Patrick Linskey
202 669 5907

Reply via email to