1. OpenJPA
  2. OPENJPA-625

Error when removing embeddable entities from a persistent collection


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.2.0
    • Component/s: kernel
    • Labels:
    • Environment:
      OpenJPA 1.1.0
      Java 6
      MySQL 5
      Extended Persistence Context
      DataCache enabled


      Say you have an EntityA which is annotated as @Embeddable and an EntityB which contains a mapping like

      @PersistentCollection(elementEmbedded = true, elementType = EntityA.class, fetch = FetchType.LAZY)
      private List<EntityA> list;

      Now if you remove an entry from the list of a persistent EntityB and commit the transaction it leads to the following exception:

      Caused by: <openjpa-1.1.0-runknown fatal user error> org.apache.openjpa.persistence.ArgumentException: Could not locate metadata for the class using oid "org.apache.openjpa.datacache.DataCachePCDataImpl@8c248cb" of type "class org.apache.openjpa.datacache.DataCachePCDataImpl".
      FailedObject: org.apache.openjpa.datacache.DataCachePCDataImpl@8c248cb
      at org.apache.openjpa.meta.MetaDataRepository.getMetaData(
      at org.apache.openjpa.kernel.BrokerImpl.newStateManagerImpl(
      at org.apache.openjpa.kernel.BrokerImpl.findAll(
      at org.apache.openjpa.kernel.BrokerImpl.findAll(
      at org.apache.openjpa.kernel.AbstractPCData.toRelationFields(
      at org.apache.openjpa.kernel.AbstractPCData.toNestedFields(
      at org.apache.openjpa.kernel.AbstractPCData.toField(
      at org.apache.openjpa.kernel.PCDataImpl.loadField(
      at org.apache.openjpa.kernel.PCDataImpl.load(
      at org.apache.openjpa.datacache.DataCacheStoreManager.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.fetchObjectField(
      at org.apache.openjpa.kernel.StateManagerImpl.fetchField(
      at org.apache.openjpa.kernel.StateManagerImpl.cascadeDelete(
      at org.apache.openjpa.kernel.BrokerImpl.deleteDeref(
      at org.apache.openjpa.kernel.BrokerImpl.flush(
      at org.apache.openjpa.kernel.BrokerImpl.flushSafe(
      at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(
      at org.apache.openjpa.kernel.LocalManagedRuntime.commit(
      at org.apache.openjpa.kernel.BrokerImpl.commit(
      at org.apache.openjpa.kernel.DelegatingBroker.commit(
      at org.apache.openjpa.persistence.EntityManagerImpl.commit(
      ... 12 more

      After some digging I think I found the cause in the AbstractPCData.toNestedFields method:

      case JavaTypes.PC:
      if (vmd.isEmbedded())
      for (Iterator itr = data.iterator(); itr.hasNext()
      ret.add(toEmbeddedField(sm, vmd,, fetch, context));
      // no break

      should probably be:

      case JavaTypes.PC:
      if (vmd.isEmbedded())

      { for (Iterator itr = data.iterator(); itr.hasNext();) ret.add(toEmbeddedField(sm, vmd,, fetch, context)); return ret; }

      // no break

      At least it worked for me this way.


        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Michael Dick made changes -
        Fix Version/s 1.2.0 [ 12313102 ]
        Pinaki Poddar made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Pinaki Poddar made changes -
        Field Original Value New Value
        Assignee Pinaki Poddar [ ]
        Matthias Seidel created issue -


          • Assignee:
            Pinaki Poddar
            Matthias Seidel
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: