openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Russell (JIRA)" <>
Subject [jira] Created: (OPENJPA-99) Enhanced pcNewInstance redundantly clears fields
Date Wed, 10 Jan 2007 20:27:27 GMT
Enhanced pcNewInstance redundantly clears fields 

                 Key: OPENJPA-99
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
            Reporter: Craig Russell

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.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message