openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Hardy (JIRA)" <>
Subject [jira] Created: (OPENJPA-560) merge() throws NPE or unable to create proxy
Date Tue, 08 Apr 2008 15:41:24 GMT
merge() throws NPE or unable to create proxy

                 Key: OPENJPA-560
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.1.0
         Environment: Linux 2.6, Java 1.5.0_12, Derby
            Reporter: Adam Hardy

I have reduced this to a stand-alone unit test and also tested it against Toplink and Hibernate,
with which it works.

So I'm looking at a pure OpenJPA issue here.

Here is the low-down:

- Parent - child entities mapped using XML as opposed to annotations
- both inherit a mapped superclass
- both have a prepersist and preupdate listener configured
- not using enhancement

This is all I do:

EntityManager entityManager =
Genus genus = entityManager.find(Genus.class, new Long(1));
// now detached
entityManager = db.entityManagerFactory.createEntityManager();

and it throws an exception. If there is a child row in the db, I get the exception below.

If there is no child in existence, I get a NullPointerException.

If I enhance the entities, all is hunkydory.

This is using OpenJPA v1.1.0 snapshot from February. 

 $Proxy13 seems to be the name of the parent's child collection property, I can see from debugging.

 <openjpa-1.1.0-SNAPSHOT-r420667:609825 fatal general error> org.apache.openjpa.persistence.PersistenceException:
Unable to create a second class object proxy for final class "class $Proxy13".
     at org.apache.openjpa.util.ProxyManagerImpl.assertNotFinal(
     at org.apache.openjpa.util.ProxyManagerImpl.generateProxyCollectionBytecode(
     at org.apache.openjpa.util.ProxyManagerImpl.getFactoryProxyCollection(
     at org.apache.openjpa.util.ProxyManagerImpl.copyCollection(
     at org.apache.openjpa.kernel.AttachStrategy.copyCollection(
     at org.apache.openjpa.kernel.AttachStrategy.attachCollection(
     at org.apache.openjpa.kernel.AttachStrategy.replaceList(
     at org.apache.openjpa.kernel.AttachStrategy.attachField(
     at org.apache.openjpa.kernel.VersionAttachStrategy.attach(
     at org.apache.openjpa.kernel.AttachManager.attach(
     at org.apache.openjpa.kernel.AttachManager.attach(
     at org.apache.openjpa.kernel.BrokerImpl.attach(
     at org.apache.openjpa.kernel.DelegatingBroker.attach(
     at org.apache.openjpa.persistence.EntityManagerImpl.merge(
     at org.permacode.atomictest.jpa.JpaSpeciesDao.persist(

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

View raw message