From dev-return-20093-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Mon Feb 6 20:55:26 2012 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 0C7F9967C for ; Mon, 6 Feb 2012 20:55:26 +0000 (UTC) Received: (qmail 80240 invoked by uid 500); 6 Feb 2012 20:55:23 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 79540 invoked by uid 500); 6 Feb 2012 20:55:23 -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 79314 invoked by uid 99); 6 Feb 2012 20:55:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Feb 2012 20:55:22 +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; Mon, 06 Feb 2012 20:55:20 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 7AB34CC177 for ; Mon, 6 Feb 2012 20:54:59 +0000 (UTC) Date: Mon, 6 Feb 2012 20:54:59 +0000 (UTC) From: "Jeremy Bauer (Created) (JIRA)" To: dev@openjpa.apache.org Message-ID: <1002630550.3612.1328561699504.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Created] (OPENJPA-2120) Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations 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 Add new option to eliminate reflection calls from enhancer generated IdClass PC copy operations ----------------------------------------------------------------------------------------------- Key: OPENJPA-2120 URL: https://issues.apache.org/jira/browse/OPENJPA-2120 Project: OpenJPA Issue Type: Improvement Components: Enhance, kernel, performance Affects Versions: 2.2.0 Reporter: Jeremy Bauer Assignee: Jeremy Bauer Profiling has shown the code in the enhancer generated pcCopyKeyFields(To/From)ObjectId to be costly when using id classes with an entity that uses field access and has non-public fields. Without public fields, reflection is used to move the values from the parent entity to the id class. This also involves a costly temporary access switch. I have a fix that interrogates the id class for a public constructor and uses that constructor (instead of costly reflection) during the copy operation. It only works for certain IdClass and entity combinations. IdClasses must have a trivial public constructor with parameters that match those of the id fields. Trivial = the constructor can only do direct field assignments from the parameter values to the id class values. No conversion can take place. The constructor can have other logic, but the assignments must be direct. The entity ids cannot be derived from other identities. If these conditions are not met, the enhancer falls back to using reflection. Since this change could result in an application behavior change (the provider calling a new constructor) it is gated by the openjpa.OptimizeIdCopy property, with the default being false. -- 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