Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-1911

InvalidStateException is thrown when merge an entity with derived identiy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.4, 1.2.2, 2.0.1, 2.1.0, 2.2.0
    • 1.2.3, 1.3.0, 2.0.2, 2.1.0, 2.2.0
    • kernel
    • None

    Description

      <openjpa-2.0.2-SNAPSHOT-r422266:1027632M nonfatal user error> org.apache.openjpa.persistence.InvalidStateException: Attempt to change a primary key field of an instance that already has a final object id. Only new, unflushed instances whose id you have not retrieved can have their primary keys changed.
      FailedObject: org.apache.openjpa.persistence.xs.AccountingHierarchyRate-TESTING::1
      at org.apache.openjpa.kernel.StateManagerImpl.assertNoPrimaryKeyChange(StateManagerImpl.java:2086)
      at org.apache.openjpa.kernel.StateManagerImpl.settingObjectField(StateManagerImpl.java:2020)
      at org.apache.openjpa.kernel.AttachStrategy.attachField(AttachStrategy.java:205)
      at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:161)
      at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:251)
      at org.apache.openjpa.kernel.AttachStrategy.attachCollection(AttachStrategy.java:339)
      at org.apache.openjpa.kernel.AttachStrategy.replaceList(AttachStrategy.java:399)
      at org.apache.openjpa.kernel.AttachStrategy.attachField(AttachStrategy.java:224)
      at org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:161)
      at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:251)
      at org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:104)
      at org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3400)
      at org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1206)
      at org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:871)
      at org.apache.openjpa.persistence.xs.TestMergeComplexKey.test(TestMergeComplexKey.java:29)

      Attachments

        1. OPENJPA-1911-2.0.x.patch
          18 kB
          Heath Thomann
        2. OPENJPA-1911-1.3.x.patch
          18 kB
          Heath Thomann
        3. OPENJPA-1911-1.2.x.patch
          18 kB
          Heath Thomann

        Activity

          People

            faywang Fay Wang
            faywang Fay Wang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: