From dev-return-19649-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Wed Nov 2 19:47:55 2011 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 9F484948F for ; Wed, 2 Nov 2011 19:47:55 +0000 (UTC) Received: (qmail 50752 invoked by uid 500); 2 Nov 2011 19:47:55 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 50717 invoked by uid 500); 2 Nov 2011 19:47:55 -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 50676 invoked by uid 99); 2 Nov 2011 19:47:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Nov 2011 19:47:55 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,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; Wed, 02 Nov 2011 19:47:53 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 2CB2A32EAF0 for ; Wed, 2 Nov 2011 19:47:32 +0000 (UTC) Date: Wed, 2 Nov 2011 19:47:32 +0000 (UTC) From: "Rick Curtis (Updated) (JIRA)" To: dev@openjpa.apache.org Message-ID: <595150833.52247.1320263252184.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <2020098196.51908.1320258812343.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (OPENJPA-2068) Improve performance of java.util.Calendar fields 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-2068?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rick Curtis updated OPENJPA-2068: --------------------------------- Attachment: OPENJPA-2068.patch I'm attaching a patch with a bulk of the changes. Obviously this isn't complete, but I want to get something out here. > Improve performance of java.util.Calendar fields > ------------------------------------------------ > > Key: OPENJPA-2068 > URL: https://issues.apache.org/jira/browse/OPENJPA-2068 > Project: OpenJPA > Issue Type: Improvement > Components: jdbc > Affects Versions: 2.2.0 > Reporter: Rick Curtis > Assignee: Rick Curtis > Attachments: OPENJPA-2068.patch > > > While doing some performance testing, I've found that we could improve the performance of loading Entities that have java.util.Calendar fields. When loading the data into a Calendar field, we actually create two Calendar instances per field. Normally creating an extra instance wouldn't be that big of a deal, but since creating a Calendar is very expensive I would like to remove creation of the extra instance. > The call flow is something like this: > - em.find(...) // find an Entity which has a calendar field > ... execute query, processing result set... > - DBDictionary.getCalendar(ResultSet,...) // Here we pull a Timestamp out of the result set, and create an unproxied Calendar instance. > ... > // now while trying to store the Calendar into the Entity instance, we find that this type needs to be proxied. > SingleFieldManager.proxy(...) // Here we create the second Calendar instance, which is a proxied calendar > I'd like to add a configuration property to DBDictionary that tells the runtime to always create proxied calendar instances. This would remove the creation of the initial un-proxied instance. For a large majority of application which use Calendars this would help. > As always, there is a catch to this approach. If you were to execute a query such as : em.createQuery("SELECT c.myCal FROM CalendarEntity c where c.id=:id", MyCalendar.class), you would get back a proxied instance. This shouldn't be that big of a deal... but still a bit of a quirk. -- 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