Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 77802 invoked from network); 23 May 2009 09:33:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 May 2009 09:33:57 -0000 Received: (qmail 82401 invoked by uid 500); 23 May 2009 09:34:09 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 82338 invoked by uid 500); 23 May 2009 09:34:09 -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 82328 invoked by uid 99); 23 May 2009 09:34:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 May 2009 09:34:09 +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; Sat, 23 May 2009 09:34:06 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8F8BA234C004 for ; Sat, 23 May 2009 02:33:45 -0700 (PDT) Message-ID: <1711823984.1243071225583.JavaMail.jira@brutus> Date: Sat, 23 May 2009 02:33:45 -0700 (PDT) From: "Milosz Tylenda (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-736) Combine insert and select SQL together for generated Id strategy=GenerationType.IDENTITY In-Reply-To: <2019546525.1222878584214.JavaMail.jira@brutus> 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-736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Milosz Tylenda updated OPENJPA-736: ----------------------------------- Attachment: supportsGetGeneratedKeys.patch The attached patch supportsGetGeneratedKeys.patch addresses point 1. The idea is to auto-detect the property only if user did not specify the property value. In order to do that, I have changed the property type from primitive boolean to Boolean. Let me know if anybody sees this problematic. > Combine insert and select SQL together for generated Id strategy=GenerationType.IDENTITY > ----------------------------------------------------------------------------------------- > > Key: OPENJPA-736 > URL: https://issues.apache.org/jira/browse/OPENJPA-736 > Project: OpenJPA > Issue Type: Improvement > Affects Versions: 1.3.0 > Reporter: Fay Wang > Assignee: Milosz Tylenda > Fix For: 1.3.0 > > Attachments: openjpa-736.patch, supportsGetGeneratedKeys.patch > > > Currently if the strategy of the generated id is GenerationType.IDENTITY, when an entity object is created, openjpa will generate two SQL statements. The following is an example running on DB2: > (1) INSERT INTO EntityA (col1, col2, col3, version) VALUES (?, ?, ?, ?) > [params=(int) 1, (int) 1, (int) 1, (int) 1] > (2) SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1 > A performance improvement is to take advantage of the "select from final table" feature in DB2 to combine the insert and select statement into a single SQL statement as shown below: > SELECT id FROM FINAL TABLE (INSERT INTO EntityA (col1, col2, col3, version) VALUES (?, ?, ?, ?) ) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.