DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
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

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 (2 kB)

openSUSE 10.3 (X86-64)
Oracle Database 10g Release - 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(
        at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(
        at org.datanucleus.jdo.JDOPersistenceManager.makePersistent(
        at org.datanucleus.test.Main.delete(
        at org.datanucleus.test.Main.main(
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(
        at org.datanucleus.ObjectManagerImpl.isInserting(
        at org.datanucleus.ObjectManagerImpl.attachObject(
        at org.datanucleus.state.AbstractStateManager.providedObjectField(
        at org.datanucleus.test.A.jdoProvideField(
        at org.datanucleus.test.A.jdoProvideFields(
        at org.datanucleus.state.JDOStateManagerImpl.provideFields(
        at org.datanucleus.state.JDOStateManagerImpl.attach(
        at org.datanucleus.ObjectManagerImpl.attachObject(
        at org.datanucleus.ObjectManagerImpl.persistObjectInternal(
        at org.datanucleus.ObjectManagerImpl.persistObject(
        at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(
        at org.datanucleus.jdo.JDOPersistenceManager.makePersistent(
        at org.datanucleus.test.Main.delete(
        at org.datanucleus.test.Main.main(

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

Sort Order: Ascending order - Click to sort in descending order
Dan Leary added a comment - 13/Jun/08 09:32 PM
Testcase attached.

Renato Garcia added a comment - 28/Jan/09 07:42 PM
You need to close the pm.

Add this to your code:


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 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