Have a base class, say B and have 2 classes derived from it X and Y.
B is @MappedSuperclass @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) X has oneY (1 to 1) unidirection @OneToOne(fetch = FetchType.EAGER, cascade = { CascadeType.ALL}) @JoinColumn(name = "Y_ID", nullable=false) Y does not know of X. Caused by: <0.9.7-incubating fatal store error> org.apache.openjpa.persistence.RollbackException: Attempt to assign id "com.testc.reporting.core.pbo.Base-201" to new instance "com.testc.reporting.core.pbo.Project-com.testc.reporting.core.pbo.Base-201" 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. at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:420) at com.testc.reporting.core.TestProject.testCreateProject(TestProject.java:54) at com.testc.reporting.core.TestProject.testProject(TestProject.java:24) at com.testc.reporting.core.Main.main(Main.java:19) ... 27 more Caused by: <0.9.7-incubating fatal user error> org.apache.openjpa.persistence.ArgumentException: Attempt to assign id "com.testc.reporting.core.pbo.Base-201" to new instance "com.testc.reporting.core.pbo.Project-com.testc.reporting.core.pbo.Base-201" 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: com.testc.reporting.core.pbo.Project-com.testc.reporting.core.pbo.Base-201 at org.apache.openjpa.kernel.BrokerImpl$ManagedCache.commitNew(BrokerImpl.java:4528) at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:3787) at org.apache.openjpa.kernel.StateManagerImpl.commit(StateManagerImpl.java:925) at org.apache.openjpa.kernel.BrokerImpl.endTransaction(BrokerImpl.java:2194) at org.apache.openjpa.kernel.BrokerImpl.afterCompletion(BrokerImpl.java:1801) at org.apache.openjpa.kernel.LocalManagedRuntime.commit(LocalManagedRuntime.java:93) at org.apache.openjpa.kernel.BrokerImpl.commit(BrokerImpl.java:1311) at org.apache.openjpa.kernel.DelegatingBroker.commit(DelegatingBroker.java:866) at org.apache.openjpa.persistence.EntityManagerImpl.commit(EntityManagerImpl.java:409) ... 30 more Patrick Linskey-2 wrote: > > Hi, > > Can you describe the relationship between Project and Base (and any > other relevant persistent classes and superclasses)? If possible, it'd > be great to see some relevant code snippets. > > Thanks, > > -Patrick > > On 5/9/07, Majeed Arni <[EMAIL PROTECTED]> wrote: >> I have 2 objects related, when I create both in a transaction and "set >> one >> object on another" and then committing. I get this error. The objects are >> stored in DB2 with auto increment -ing identity. >> >> "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." >> >> Caused by: <0.9.7-incubating fatal user error> >> org.apache.openjpa.persistence.ArgumentException: Attempt to assign id >> "com.XXX.core.pbo.Base-141" to new instance >> "com.XXXX.core.pbo.Project-com.XXXX.core.pbo.Base-141" 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: com.XXXXX.core.pbo.Project-com.XXXX.core.pbo.Base-141 >> at org.apache.openjpa.kernel.BrokerImpl$ManagedCache.commitNew( >> BrokerImpl.java:4528) >> at org.apache.openjpa.kernel.BrokerImpl.setStateManager( >> BrokerImpl.java:3787) >> at org.apache.openjpa.kernel.StateManagerImpl.commit( >> StateManagerImpl.java:925) >> at org.apache.openjpa.kernel.BrokerImpl.endTransaction( >> BrokerImpl.java:2194) >> at org.apache.openjpa.kernel.BrokerImpl.afterCompletion( >> BrokerImpl.java:1801) >> at org.apache.openjpa.kernel.LocalManagedRuntime.commit( >> LocalManagedRuntime.java:93) >> at org.apache.openjpa.kernel.BrokerImpl.commit( >> BrokerImpl.java:1311) >> at org.apache.openjpa.kernel.DelegatingBroker.commit( >> DelegatingBroker.java:866) >> at org.apache.openjpa.persistence.EntityManagerImpl.commit( >> EntityManagerImpl.java:409) >> >> Regards, >> >> Majeed Arni >> > > > -- > Patrick Linskey > 202 669 5907 > > -- View this message in context: http://www.nabble.com/Bug-when-persisting-two-related-objects-tf3719319.html#a10415652 Sent from the open-jpa-dev mailing list archive at Nabble.com.