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 BE70D8AC for ; Thu, 28 Apr 2011 19:52:44 +0000 (UTC) Received: (qmail 91526 invoked by uid 500); 28 Apr 2011 19:52:44 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 91493 invoked by uid 500); 28 Apr 2011 19:52:44 -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 91485 invoked by uid 99); 28 Apr 2011 19:52:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Apr 2011 19:52:44 +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; Thu, 28 Apr 2011 19:52:42 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 31F4FB8E51 for ; Thu, 28 Apr 2011 19:52:03 +0000 (UTC) Date: Thu, 28 Apr 2011 19:52:03 +0000 (UTC) From: "Rick Curtis (JIRA)" To: dev@openjpa.apache.org Message-ID: <21225415.9676.1304020323185.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <229011570.6379.1303922703063.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (OPENJPA-1986) Extra queries being generated when cascading a persist 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-1986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13026655#comment-13026655 ] Rick Curtis commented on OPENJPA-1986: -------------------------------------- When porting this code back to 2.1.x, we need to make sure to flip the compatibility option so we don't break any existing applications. > Extra queries being generated when cascading a persist > ------------------------------------------------------ > > Key: OPENJPA-1986 > URL: https://issues.apache.org/jira/browse/OPENJPA-1986 > Project: OpenJPA > Issue Type: Bug > Components: performance > Affects Versions: 2.0.1, 2.1.0, 2.2.0 > Reporter: Rick Curtis > Assignee: Rick Curtis > Fix For: 2.2.0 > > Attachments: OPENJPA-1986.patch > > > I found a scenario where extra queries were being generated while cascading a persist to a new Entity. See the following example: > @Entity > public class CascadePersistEntity implements Serializable { > private static final long serialVersionUID = -8290604110046006897L; > @Id > long id; > @OneToOne(cascade = CascadeType.ALL) > CascadePersistEntity other; > ... > } > and the following scenario: > CascadePersistEntity cpe1 = new CascadePersistEntity(1); > CascadePersistEntity cpe2 = new CascadePersistEntity(2); > cpe1.setOther(cpe2); > em.persist(cpe1); > This results in two inserts and one select. The extra select is what I'm going to get rid of with this JIRA. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira