openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Wiles (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-99) Enhanced pcNewInstance redundantly clears fields
Date Fri, 13 Jul 2012 13:01:34 GMT


Michael Wiles commented on OPENJPA-99:

Is this going to be fixed? it's been a while and it's still a problem.
> Enhanced pcNewInstance redundantly clears fields 
> -------------------------------------------------
>                 Key: OPENJPA-99
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>            Reporter: Craig L 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, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message