Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 4948 invoked from network); 18 Sep 2010 15:16:34 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Sep 2010 15:16:34 -0000 Received: (qmail 43825 invoked by uid 500); 18 Sep 2010 15:16:34 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 43663 invoked by uid 500); 18 Sep 2010 15:16:32 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 43655 invoked by uid 99); 18 Sep 2010 15:16:31 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Sep 2010 15:16:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Sep 2010 15:16:13 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o8IFFq2P001124 for ; Sat, 18 Sep 2010 15:15:52 GMT Message-ID: <16687918.274991284822952130.JavaMail.jira@thor> Date: Sat, 18 Sep 2010 11:15:52 -0400 (EDT) From: "Harald Wellmann (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Created: (OPENJPA-1803) Unwrap EntityManager to Connection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org 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.