You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Harald Wellmann (JIRA)" <ji...@apache.org> on 2010/09/18 17:15:52 UTC

[jira] Created: (OPENJPA-1803) Unwrap EntityManager to Connection

Unwrap EntityManager to Connection
----------------------------------

                 Key: OPENJPA-1803
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1803
             Project: OpenJPA
          Issue Type: Improvement
          Components: jpa
    Affects Versions: 2.0.1
            Reporter: Harald Wellmann


This is currently the recommended way to access the javax.sql.Connection underlying an EntityManager:

        OpenJPAEntityManager oem = OpenJPAPersistence.cast(em);
        Connection con = (Connection) oem.getConnection();

It would be more convenient to simply write

        Connection con = em.unwrap(Connection.class);

That way, the client needing to access the Connection only depends on the javax.persistence API and not on org.apache.openjpa.*.

I believe the JPA 2.0 spec neither mandates nor forbids this functionality. It is supported by Eclipselink 2.x.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-1803) Unwrap EntityManager to Connection

Posted by "Donald Woods (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-1803?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Donald Woods updated OPENJPA-1803:
----------------------------------

    Component/s: competitive

> Unwrap EntityManager to Connection
> ----------------------------------
>
>                 Key: OPENJPA-1803
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1803
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: competitive, jpa
>    Affects Versions: 2.0.1
>            Reporter: Harald Wellmann
>
> This is currently the recommended way to access the javax.sql.Connection underlying an EntityManager:
>         OpenJPAEntityManager oem = OpenJPAPersistence.cast(em);
>         Connection con = (Connection) oem.getConnection();
> It would be more convenient to simply write
>         Connection con = em.unwrap(Connection.class);
> That way, the client needing to access the Connection only depends on the javax.persistence API and not on org.apache.openjpa.*.
> I believe the JPA 2.0 spec neither mandates nor forbids this functionality. It is supported by Eclipselink 2.x.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.