org.apache.openjpa.persistence.ArgumentException: Attempt to assign id "0" to new instance "my.package.A-0" failed; there is already an object in the L1 cache with this id. You must delete this object (in a previous transaction or the current one) before reusing its id. This error can also occur when a horizontally or vertically mapped classes uses auto-increment application identity and does not use a hierarchy of application identity classes. FailedObject: my.package.A-0

openjpa-users | padamstx | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Problem when using @Generated with non-primary key column

    openjpa-users | 2 years ago | padamstx
    org.apache.openjpa.persistence.ArgumentException: Attempt to assign id "0" to new instance "my.package.A-0" failed; there is already an object in the L1 cache with this id. You must delete this object (in a previous transaction or the current one) before reusing its id. This error can also occur when a horizontally or vertically mapped classes uses auto-increment application identity and does not use a hierarchy of application identity classes. FailedObject: my.package.A-0

    Root Cause Analysis

    1. org.apache.openjpa.persistence.ArgumentException

      Attempt to assign id "0" to new instance "my.package.A-0" failed; there is already an object in the L1 cache with this id. You must delete this object (in a previous transaction or the current one) before reusing its id. This error can also occur when a horizontally or vertically mapped classes uses auto-increment application identity and does not use a hierarchy of application identity classes. FailedObject: my.package.A-0

      at org.apache.openjpa.kernel.ManagedCache.commitNew()
    2. OpenJPA Aggregate Jar
      BrokerImpl.endTransaction
      1. org.apache.openjpa.kernel.ManagedCache.commitNew(ManagedCache.java:236)
      2. org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4145)
      3. org.apache.openjpa.kernel.StateManagerImpl.commit(StateManagerImpl.java:1164)
      4. org.apache.openjpa.kernel.BrokerImpl.endTransaction(BrokerImpl.java:2433)
      4 frames