openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (Commented) (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-2068) Improve performance of java.util.Calendar fields
Date Thu, 19 Jan 2012 15:34:41 GMT


Rick Curtis commented on OPENJPA-2068:

The bug we hit resulted in the following exception:

<openjpa-2.2.0-SNAPSHOT-r422266:1232415 nonfatal user error> org.apache.openjpa.persistence.InvalidStateException:
This container was loaded in large result set field "[x].entities.LrsEntityA.entitybs", but
has been removed from its owning field. Therefore, it can no longer be used.
at org.apache.openjpa.jdbc.meta.strats.LRSProxyCollection.assertOwner(
at org.apache.openjpa.jdbc.meta.strats.LRSProxyCollection.itr(
at org.apache.openjpa.util.AbstractLRSProxyCollection.iterator(
at org.apache.openjpa.util.ProxyCollections.addAll(
at$util$ArrayList$proxy.addAll(Unknown Source)
at org.apache.openjpa.kernel.SingleFieldManager.proxy(
at org.apache.openjpa.kernel.StateManagerImpl.storeObjectField(
at org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.load(
at org.apache.openjpa.jdbc.meta.FieldMapping.load(
at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(
at org.apache.openjpa.kernel.DelegatingStoreManager.load(
at org.apache.openjpa.kernel.ROPStoreManager.load(
at org.apache.openjpa.kernel.StateManagerImpl.loadFields(
at org.apache.openjpa.kernel.StateManagerImpl.loadField(
at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(
at org.apache.openjpa.kernel.StateManagerImpl.accessingField(
at [x].entities.LrsEntityA.pcGetentitybs(
at [x].entities.LrsEntityA.getEntitybs(

> Improve performance of java.util.Calendar fields
> ------------------------------------------------
>                 Key: OPENJPA-2068
>                 URL:
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: jdbc
>    Affects Versions: 2.2.0
>            Reporter: Rick Curtis
>            Assignee: Rick Curtis
>             Fix For: 2.2.0
>         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", 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:!default.jspa
For more information on JIRA, see:


View raw message