Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 29069 invoked from network); 24 Mar 2010 22:11:51 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 24 Mar 2010 22:11:51 -0000 Received: (qmail 23057 invoked by uid 500); 24 Mar 2010 22:11:51 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 23034 invoked by uid 500); 24 Mar 2010 22:11:51 -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 23026 invoked by uid 99); 24 Mar 2010 22:11:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Mar 2010 22:11:51 +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.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Mar 2010 22:11:48 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 3E0F8234C4CB for ; Wed, 24 Mar 2010 22:11:27 +0000 (UTC) Message-ID: <1932935456.475161269468687252.JavaMail.jira@brutus.apache.org> Date: Wed, 24 Mar 2010 22:11:27 +0000 (UTC) From: "Heath Thomann (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-1550) When batchLimit=-1 or >1 and an exception is caused, the params and failedObject are missing from the resultant exception. In-Reply-To: <2088415546.88501267760007120.JavaMail.jira@brutus.apache.org> 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 [ https://issues.apache.org/jira/browse/OPENJPA-1550?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Heath Thomann updated OPENJPA-1550: ----------------------------------- Attachment: OPENJPA-1550-trunk-testcase.patch.txt OPENJPA-1550-13x-v2.diff.txt OPENJPA-1550v2.diff.txt Adding code to allow the 'failed object' to percolate up to the RollbackException. > When batchLimit=-1 or >1 and an exception is caused, the params and failedObject are missing from the resultant exception. > -------------------------------------------------------------------------------------------------------------------------- > > Key: OPENJPA-1550 > URL: https://issues.apache.org/jira/browse/OPENJPA-1550 > Project: OpenJPA > Issue Type: Bug > Components: jdbc > Affects Versions: 1.2.2, 1.3.0, 2.0.0-beta2 > Reporter: Heath Thomann > Assignee: Donald Woods > Priority: Minor > Fix For: 1.2.3, 1.3.0, 2.0.0 > > Attachments: OPENJPA-1550-13x-testcase.patch.txt, OPENJPA-1550-13x-v2.diff.txt, OPENJPA-1550-13x.patch, OPENJPA-1550-trunk-testcase.patch.txt, OPENJPA-1550-trunk.patch, OPENJPA-1550.diff.txt, OPENJPA-1550v2.diff.txt > > > Exception reporting is different depending on the value of batchLimit. To describe and demonstration this problem, lets take the following Entitiy: > @Entity > public class Ent1 { > @Id > private int pk; > private String name; > ..... > } > As a test, lets assume that we have an Ent1 with pk=200 already defined in the DB and our test will attempt to create and persist another Ent1 with pk=200 (i.e. a duplicate key). In so doing we get the following exception as indicated by the batchLimit settings: > batchLimit=0 or batchLimit=1 > Caused by: org.apache.openjpa.persistence.EntityExistsException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL100301111328870' defined on 'ENT1'. {prepstmnt 33038075 INSERT INTO Ent1 (pk, name) VALUES (?, ?) [params=(int) 200, (String) twohundred]} [code=20000, state=23505] > FailedObject: siemens75007.Ent1@19d0e0b > when batchLimit=-1 or >1 > Caused by: org.apache.openjpa.persistence.EntityExistsException: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL100301111328870' defined on 'ENT1'. > FailedObject: prepstmnt 33038075 INSERT INTO Ent1 (pk, name) VALUES (?, ?) [org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement] > Notice that when batchLimit=[0,1], the exception lists the prepared statement used along with the params which caused the failure, as well as the 'FailedObject'. Furthermore, calling 'getFailedObject' on the resultant exception will give the caller the entity which caused the failure. In contrast, when batchLimit=-1 or a value greater than 1, we can see that the exception message is missing the prepared statement info, however, it is presented in the 'FailedObject'. The params are also missing from the prepared statement. A call to 'getFailedObject' on the resultant exception will NOT give the caller the entity which caused the exception. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.