Issue Details (XML | Word | Printable)

Key: NUCCORE-284
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Unassigned
Reporter: Dan Leary
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Attaching detached object throws: Object ... is managed by a different Object Manager

Created: 13/Jun/08 09:31 PM   Updated: 11/Sep/09 08:39 AM   Resolved: 25/Aug/09 09:03 AM
Component/s: None
Affects Version/s: 1.0.0.m2
Fix Version/s: None

File Attachments: 1. Zip Archive testcase.zip (2 kB)

Environment:
openSUSE 10.3 (X86-64)
Oracle Database 10g Release 10.2.0.3.0 - 64bit Production
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b19, mixed mode)
Nightly 1.0-SNAPSHOT jars from 2008-06-13

Datastore: Oracle


 Description  « Hide
I'm getting an unexpected exception:

16:19:03,587 (main) INFO [DataNucleus.JDO] - >> Exception thrown deleting object
javax.jdo.JDOUserException: Object with id "1[OID]org.datanucleus.test.A" is managed by a different Object Manager
        at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:354)
        at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:671)
        at org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:691)
        at org.datanucleus.test.Main.delete(Main.java:54)
        at org.datanucleus.test.Main.main(Main.java:26)
NestedThrowablesStackTrace:
Object with id "1[OID]org.datanucleus.test.A" is managed by a different Object Manager
org.datanucleus.exceptions.NucleusUserException: Object with id "1[OID]org.datanucleus.test.A" is managed by a different Object Manager
        at org.datanucleus.ObjectManagerImpl.findStateManager(ObjectManagerImpl.java:674)
        at org.datanucleus.ObjectManagerImpl.isInserting(ObjectManagerImpl.java:521)
        at org.datanucleus.ObjectManagerImpl.attachObject(ObjectManagerImpl.java:1590)
        at org.datanucleus.store.fieldmanager.AttachFieldManager.storeObjectField(AttachFieldManager.java:238)
        at org.datanucleus.state.AbstractStateManager.providedObjectField(AbstractStateManager.java:761)
        at org.datanucleus.test.A.jdoProvideField(A.java)
        at org.datanucleus.test.A.jdoProvideFields(A.java)
        at org.datanucleus.state.JDOStateManagerImpl.provideFields(JDOStateManagerImpl.java:2610)
        at org.datanucleus.state.JDOStateManagerImpl.attach(JDOStateManagerImpl.java:3814)
        at org.datanucleus.ObjectManagerImpl.attachObject(ObjectManagerImpl.java:1620)
        at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1164)
        at org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1080)
        at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:666)
        at org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:691)
        at org.datanucleus.test.Main.delete(Main.java:54)
        at org.datanucleus.test.Main.main(Main.java:26)

When attempting to reattach a previously detached PC instance.
The attached test case assumes DetachAllOnCommit=true and CopyOnAttach=false



Dan Leary added a comment - 13/Jun/08 09:32 PM
Testcase attached.

Dan Leary made changes - 13/Jun/08 09:32 PM
Field Original Value New Value
Attachment testcase.zip [ 10762 ]
Renato Garcia added a comment - 28/Jan/09 07:42 PM
You need to close the pm.

Add this to your code:

   pm.close();

in the following lines:

   finally { if (tx.isActive()) tx.rollback(); }

should be like this

   finally { if (tx.isActive()) tx.rollback(); pm.close()}

This should solve the current exception.

Andy Jefferson made changes - 01/May/09 03:03 PM
Project DataNucleus Access Platform [ 10140 ] DataNucleus Core [ 10143 ]
Key NUCACCESS-9 NUCCORE-284
Affects Version/s 1.0.0.m2 [ 10352 ]
Affects Version/s 1.0.0.m2 [ 10353 ]
Andy Jefferson added a comment - 25/Aug/09 09:03 AM
Doesn't demonstrate anything that I can see. As already mentioned, creating a PM and not closing it is a strange coding practice

Andy Jefferson made changes - 25/Aug/09 09:03 AM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Cannot Reproduce [ 5 ]
Andy Jefferson made changes - 11/Sep/09 08:39 AM
Status Resolved [ 5 ] Closed [ 6 ]