Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E13959CF7 for ; Fri, 16 Mar 2012 15:10:01 +0000 (UTC) Received: (qmail 79187 invoked by uid 500); 16 Mar 2012 15:10:00 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 78747 invoked by uid 500); 16 Mar 2012 15:09:59 -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 78732 invoked by uid 99); 16 Mar 2012 15:09:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2012 15:09:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2012 15:09:58 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 52B7B23981 for ; Fri, 16 Mar 2012 15:09:38 +0000 (UTC) Date: Fri, 16 Mar 2012 15:09:38 +0000 (UTC) From: "Prabhat (Created) (JIRA)" To: dev@openjpa.apache.org Message-ID: <69629533.24867.1331910578479.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (OPENJPA-2155) Transaction Management in multiple Entities in one transaction 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 Transaction Management in multiple Entities in one transaction -------------------------------------------------------------- Key: OPENJPA-2155 URL: https://issues.apache.org/jira/browse/OPENJPA-2155 Project: OpenJPA Issue Type: Question Components: jpa Affects Versions: 2.1.1 Environment: WebSphere Application Server 6.1.37 on Windows and AIX Reporter: Prabhat I am a new user on OpenJPA, I have a scenario where I need to perform update/insert in multiple entities on one transaction. How to achieve this? example of EntityManager update method (auto generated by Rational Software Architect8.0.3). [ The same way, I have two more entities. ] ================== @Action(Action.ACTION_TYPE.UPDATE) public String updateKna1(Kna1 kna1) throws Exception { EntityManager em = getEntityManager(); try { em.getTransaction().begin(); kna1 = em.merge(kna1); em.getTransaction().commit(); } catch (Exception ex) { try { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } } catch (Exception e) { ex.printStackTrace(); throw e; } throw ex; } finally { ////em.close(); } return ""; } ========================== If I keep commit/rollback in each entity then I can not rollback from all previous entities (if last entity insert or update fails). Can you help me on this? Thanks in Advance. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira