openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey (JIRA)" <>
Subject [jira] Updated: (OPENJPA-99) Enhanced pcNewInstance redundantly clears fields
Date Sun, 27 Apr 2008 23:12:55 GMT


Patrick Linskey updated OPENJPA-99:

    Fix Version/s:     (was: 1.1.0)

Bumping to 1.2.0. While this may be a waste of CPU, it seems like a risky change at this late

> Enhanced pcNewInstance redundantly clears fields 
> -------------------------------------------------
>                 Key: OPENJPA-99
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Craig Russell
>             Fix For: 1.2.0
> This exception occurs when using an Entity with a not-null requirement for the object
id field. During creation of the Entity via the enhancer-generated method pcNewInstance, the
enhancer-generated method pcClearFields iterates fields and invokes the enhancer-modified
setter method with the Java default value (null for reference types). The user's setter method
enforces not-null values and throws an exception.
> I think that there is no need to have the pcNewInstance call the pcClearFields method
to set values for fields that have already been set to their Java default values. In addition
to the not-null requirement (which is not illegal according to the JPA specification) this
behavior also affects performance. Redundantly setting fields is a waste of CPU.
>      [java] <0|false|0.9.6-incubating> org.apache.openjpa.persistence.PersistenceException:
>      [java]     at org.apache.openjpa.kernel.BrokerImpl.find(
>      [java]     at org.apache.openjpa.kernel.BrokerImpl.find(
>      [java]     at org.apache.openjpa.kernel.DelegatingBroker.find(
>      [java]     at org.apache.openjpa.persistence.EntityManagerImpl.find(
>      [java]     at pb.adapter.EJB3Adapter.lookupComponent(
>      [java]     at pb.common.InternalDriver.lookupComponent(
>      [java]     at pb.common.InternalDriver.createRelationships(
>      [java]     at pb.OCDriver.createRelationships(
>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(
>      [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>      [java]     at java.lang.reflect.Method.invoke(
>      [java]     at com.sun.faban.driver.core.AgentThread.timeRun(
>      [java]     at
>      [java] Caused by: java.lang.NumberFormatException: null
>      [java]     at java.lang.Integer.parseInt(
>      [java]     at java.lang.Integer.parseInt(
>      [java]     at pb.common.Component.pcsetId(
>      [java]     at pb.common.Component.pcClearFields(
>      [java]     at pb.common.Component.pcNewInstance(
>      [java]     at org.apache.openjpa.enhance.PCRegistry.newInstance(
>      [java]     at org.apache.openjpa.kernel.StateManagerImpl.initialize(
>      [java]     at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(
>      [java]     at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(
>      [java]     at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(
>      [java]     at org.apache.openjpa.kernel.ROPStoreManager.initialize(
>      [java]     at org.apache.openjpa.kernel.BrokerImpl.initialize(
>      [java]     at org.apache.openjpa.kernel.BrokerImpl.find(

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message