Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Teneo : JDOUserException while changing eContainer of an object
Teneo : JDOUserException while changing eContainer of an object [message #57975] Wed, 18 October 2006 15:34 Go to next message
Eclipse UserFriend
Originally posted by: mat.loo.gmail.com

Hi,

I try to change the container of an EObject. The EMF Command that does so
is a Compound one that removes (RemoveCommand) the object from the list of
its container (and the cross reference is also deleted) and then a set the
new Container to my object (SetCommand).

While notifying the remove, when trying to remove my object from
StoreResource.loadedObjects, it does a loadedObjects.remove(myObject) that
calls the equals of my object and you can see what happens.

Isn't it possible to change the container of an object in Teneo/JPox
context ?
Should I override the commands ? And How ? My object will still be without
container at a given time, am I right ?

Thx

Caused by: javax.jdo.JDOUserException: Cannot read fields from a deleted
object
FailedObject:6[OID]thales.themis.macha.impl.A429_BusImpl
at
org.jpox.state.jdo.PersistentDeleted.transitionReadField(Per sistentDeleted.java:115)
at
org.jpox.state.StateManagerImpl.transitionReadField(StateMan agerImpl.java:3256)
at org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1906)
at thales.themis.macha.impl.A429_BusImpl.jdoGetbus_name(A429_Bu sImpl.java)
at
thales.themis.macha.impl.A429_BusImpl.getBus_name(A429_BusIm pl.java:307)
at thales.themis.macha.impl.A429_BusImpl.equals(A429_BusImpl.ja va:783)
at java.util.ArrayList.remove(ArrayList.java:425)
at
org.eclipse.emf.teneo.resource.StoreResource.removedEObject( StoreResource.java:419)
at
org.eclipse.emf.teneo.resource.StoreResource.detachedHelper( StoreResource.java:481)
at
org.eclipse.emf.teneo.jpox.resource.JPOXResource.detached(JP OXResource.java:183)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eBasicSetContain er(BasicEObjectImpl.java:903)
at
thales.themis.macha.impl.A429_BusImpl.basicSetSpecification( A429_BusImpl.java:529)
at
thales.themis.macha.impl.A429_BusImpl.eInverseRemove(A429_Bu sImpl.java:587)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseRemove(B asicEObjectImpl.java:1016)
at
org.eclipse.emf.ecore.util.DelegatingEcoreEList.inverseRemov e(DelegatingEcoreEList.java:402)
at
org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.remove(DelegatingNotifyingListImpl.java:688)
at
org.eclipse.emf.edit.command.RemoveCommand.doExecute(RemoveC ommand.java:322)
at
org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:128)
at
org.eclipse.emf.common.command.CompoundCommand.execute(Compo undCommand.java:268)
at
org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:91)
Re: Teneo : JDOUserException while changing eContainer of an object [message #57999 is a reply to message #57975] Wed, 18 October 2006 15:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Mat,

You should not override equals on an EObject implementation. EMF
relies on being able to use == for comparison and assumes this will
behave the same as .equals. EMF also relies on being able to use
EObjects as keys in a map, so making equality depend on the state of the
object will break that capability. EcoreUtil.equals can be used to do
structural equality checking...


Mat Lo wrote:

> Hi,
>
> I try to change the container of an EObject. The EMF Command that does
> so is a Compound one that removes (RemoveCommand) the object from the
> list of its container (and the cross reference is also deleted) and
> then a set the new Container to my object (SetCommand).
>
> While notifying the remove, when trying to remove my object from
> StoreResource.loadedObjects, it does a loadedObjects.remove(myObject)
> that calls the equals of my object and you can see what happens.
>
> Isn't it possible to change the container of an object in Teneo/JPox
> context ?
> Should I override the commands ? And How ? My object will still be
> without container at a given time, am I right ?
>
> Thx
>
> Caused by: javax.jdo.JDOUserException: Cannot read fields from a
> deleted object
> FailedObject:6[OID]thales.themis.macha.impl.A429_BusImpl
> at
> org.jpox.state.jdo.PersistentDeleted.transitionReadField(Per sistentDeleted.java:115)
>
> at
> org.jpox.state.StateManagerImpl.transitionReadField(StateMan agerImpl.java:3256)
>
> at
> org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1906)
> at
> thales.themis.macha.impl.A429_BusImpl.jdoGetbus_name(A429_Bu sImpl.java)
> at
> thales.themis.macha.impl.A429_BusImpl.getBus_name(A429_BusIm pl.java:307)
> at
> thales.themis.macha.impl.A429_BusImpl.equals(A429_BusImpl.ja va:783)
> at java.util.ArrayList.remove(ArrayList.java:425)
> at
> org.eclipse.emf.teneo.resource.StoreResource.removedEObject( StoreResource.java:419)
>
> at
> org.eclipse.emf.teneo.resource.StoreResource.detachedHelper( StoreResource.java:481)
>
> at
> org.eclipse.emf.teneo.jpox.resource.JPOXResource.detached(JP OXResource.java:183)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eBasicSetContain er(BasicEObjectImpl.java:903)
>
> at
> thales.themis.macha.impl.A429_BusImpl.basicSetSpecification( A429_BusImpl.java:529)
>
> at
> thales.themis.macha.impl.A429_BusImpl.eInverseRemove(A429_Bu sImpl.java:587)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseRemove(B asicEObjectImpl.java:1016)
>
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.inverseRemov e(DelegatingEcoreEList.java:402)
>
> at
> org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.remove(DelegatingNotifyingListImpl.java:688)
>
> at
> org.eclipse.emf.edit.command.RemoveCommand.doExecute(RemoveC ommand.java:322)
>
> at
> org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:128)
>
> at
> org.eclipse.emf.common.command.CompoundCommand.execute(Compo undCommand.java:268)
>
> at
> org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:91)
>
>
Re: Teneo : JDOUserException while changing eContainer of an object [message #58024 is a reply to message #57975] Wed, 18 October 2006 16:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
When do you actually delete the object? Or how does your object get into a deleted state while you
do not do a persistencemanager.delete?

You can also look here (can apply to your case also):
http://www.elver.org/jpox/jpox_details.html#cutpaste

gr. Martin

Mat Lo wrote:
> Hi,
>
> I try to change the container of an EObject. The EMF Command that does
> so is a Compound one that removes (RemoveCommand) the object from the
> list of its container (and the cross reference is also deleted) and then
> a set the new Container to my object (SetCommand).
>
> While notifying the remove, when trying to remove my object from
> StoreResource.loadedObjects, it does a loadedObjects.remove(myObject)
> that calls the equals of my object and you can see what happens.
>
> Isn't it possible to change the container of an object in Teneo/JPox
> context ?
> Should I override the commands ? And How ? My object will still be
> without container at a given time, am I right ?
>
> Thx
>
> Caused by: javax.jdo.JDOUserException: Cannot read fields from a deleted
> object
> FailedObject:6[OID]thales.themis.macha.impl.A429_BusImpl
> at
> org.jpox.state.jdo.PersistentDeleted.transitionReadField(Per sistentDeleted.java:115)
>
> at
> org.jpox.state.StateManagerImpl.transitionReadField(StateMan agerImpl.java:3256)
>
> at org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1906)
> at
> thales.themis.macha.impl.A429_BusImpl.jdoGetbus_name(A429_Bu sImpl.java)
> at
> thales.themis.macha.impl.A429_BusImpl.getBus_name(A429_BusIm pl.java:307)
> at thales.themis.macha.impl.A429_BusImpl.equals(A429_BusImpl.ja va:783)
> at java.util.ArrayList.remove(ArrayList.java:425)
> at
> org.eclipse.emf.teneo.resource.StoreResource.removedEObject( StoreResource.java:419)
>
> at
> org.eclipse.emf.teneo.resource.StoreResource.detachedHelper( StoreResource.java:481)
>
> at
> org.eclipse.emf.teneo.jpox.resource.JPOXResource.detached(JP OXResource.java:183)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eBasicSetContain er(BasicEObjectImpl.java:903)
>
> at
> thales.themis.macha.impl.A429_BusImpl.basicSetSpecification( A429_BusImpl.java:529)
>
> at
> thales.themis.macha.impl.A429_BusImpl.eInverseRemove(A429_Bu sImpl.java:587)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseRemove(B asicEObjectImpl.java:1016)
>
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.inverseRemov e(DelegatingEcoreEList.java:402)
>
> at
> org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.remove(DelegatingNotifyingListImpl.java:688)
>
> at
> org.eclipse.emf.edit.command.RemoveCommand.doExecute(RemoveC ommand.java:322)
>
> at
> org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:128)
>
> at
> org.eclipse.emf.common.command.CompoundCommand.execute(Compo undCommand.java:268)
>
> at
> org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:91)
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: Teneo : JDOUserException while changing eContainer of an object [message #594260 is a reply to message #57975] Wed, 18 October 2006 15:40 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Mat,

You should not override equals on an EObject implementation. EMF
relies on being able to use == for comparison and assumes this will
behave the same as .equals. EMF also relies on being able to use
EObjects as keys in a map, so making equality depend on the state of the
object will break that capability. EcoreUtil.equals can be used to do
structural equality checking...


Mat Lo wrote:

> Hi,
>
> I try to change the container of an EObject. The EMF Command that does
> so is a Compound one that removes (RemoveCommand) the object from the
> list of its container (and the cross reference is also deleted) and
> then a set the new Container to my object (SetCommand).
>
> While notifying the remove, when trying to remove my object from
> StoreResource.loadedObjects, it does a loadedObjects.remove(myObject)
> that calls the equals of my object and you can see what happens.
>
> Isn't it possible to change the container of an object in Teneo/JPox
> context ?
> Should I override the commands ? And How ? My object will still be
> without container at a given time, am I right ?
>
> Thx
>
> Caused by: javax.jdo.JDOUserException: Cannot read fields from a
> deleted object
> FailedObject:6[OID]thales.themis.macha.impl.A429_BusImpl
> at
> org.jpox.state.jdo.PersistentDeleted.transitionReadField(Per sistentDeleted.java:115)
>
> at
> org.jpox.state.StateManagerImpl.transitionReadField(StateMan agerImpl.java:3256)
>
> at
> org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1906)
> at
> thales.themis.macha.impl.A429_BusImpl.jdoGetbus_name(A429_Bu sImpl.java)
> at
> thales.themis.macha.impl.A429_BusImpl.getBus_name(A429_BusIm pl.java:307)
> at
> thales.themis.macha.impl.A429_BusImpl.equals(A429_BusImpl.ja va:783)
> at java.util.ArrayList.remove(ArrayList.java:425)
> at
> org.eclipse.emf.teneo.resource.StoreResource.removedEObject( StoreResource.java:419)
>
> at
> org.eclipse.emf.teneo.resource.StoreResource.detachedHelper( StoreResource.java:481)
>
> at
> org.eclipse.emf.teneo.jpox.resource.JPOXResource.detached(JP OXResource.java:183)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eBasicSetContain er(BasicEObjectImpl.java:903)
>
> at
> thales.themis.macha.impl.A429_BusImpl.basicSetSpecification( A429_BusImpl.java:529)
>
> at
> thales.themis.macha.impl.A429_BusImpl.eInverseRemove(A429_Bu sImpl.java:587)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseRemove(B asicEObjectImpl.java:1016)
>
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.inverseRemov e(DelegatingEcoreEList.java:402)
>
> at
> org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.remove(DelegatingNotifyingListImpl.java:688)
>
> at
> org.eclipse.emf.edit.command.RemoveCommand.doExecute(RemoveC ommand.java:322)
>
> at
> org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:128)
>
> at
> org.eclipse.emf.common.command.CompoundCommand.execute(Compo undCommand.java:268)
>
> at
> org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:91)
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Teneo : JDOUserException while changing eContainer of an object [message #594273 is a reply to message #57975] Wed, 18 October 2006 16:00 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi,
When do you actually delete the object? Or how does your object get into a deleted state while you
do not do a persistencemanager.delete?

You can also look here (can apply to your case also):
http://www.elver.org/jpox/jpox_details.html#cutpaste

gr. Martin

Mat Lo wrote:
> Hi,
>
> I try to change the container of an EObject. The EMF Command that does
> so is a Compound one that removes (RemoveCommand) the object from the
> list of its container (and the cross reference is also deleted) and then
> a set the new Container to my object (SetCommand).
>
> While notifying the remove, when trying to remove my object from
> StoreResource.loadedObjects, it does a loadedObjects.remove(myObject)
> that calls the equals of my object and you can see what happens.
>
> Isn't it possible to change the container of an object in Teneo/JPox
> context ?
> Should I override the commands ? And How ? My object will still be
> without container at a given time, am I right ?
>
> Thx
>
> Caused by: javax.jdo.JDOUserException: Cannot read fields from a deleted
> object
> FailedObject:6[OID]thales.themis.macha.impl.A429_BusImpl
> at
> org.jpox.state.jdo.PersistentDeleted.transitionReadField(Per sistentDeleted.java:115)
>
> at
> org.jpox.state.StateManagerImpl.transitionReadField(StateMan agerImpl.java:3256)
>
> at org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1906)
> at
> thales.themis.macha.impl.A429_BusImpl.jdoGetbus_name(A429_Bu sImpl.java)
> at
> thales.themis.macha.impl.A429_BusImpl.getBus_name(A429_BusIm pl.java:307)
> at thales.themis.macha.impl.A429_BusImpl.equals(A429_BusImpl.ja va:783)
> at java.util.ArrayList.remove(ArrayList.java:425)
> at
> org.eclipse.emf.teneo.resource.StoreResource.removedEObject( StoreResource.java:419)
>
> at
> org.eclipse.emf.teneo.resource.StoreResource.detachedHelper( StoreResource.java:481)
>
> at
> org.eclipse.emf.teneo.jpox.resource.JPOXResource.detached(JP OXResource.java:183)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eBasicSetContain er(BasicEObjectImpl.java:903)
>
> at
> thales.themis.macha.impl.A429_BusImpl.basicSetSpecification( A429_BusImpl.java:529)
>
> at
> thales.themis.macha.impl.A429_BusImpl.eInverseRemove(A429_Bu sImpl.java:587)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eInverseRemove(B asicEObjectImpl.java:1016)
>
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.inverseRemov e(DelegatingEcoreEList.java:402)
>
> at
> org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.remove(DelegatingNotifyingListImpl.java:688)
>
> at
> org.eclipse.emf.edit.command.RemoveCommand.doExecute(RemoveC ommand.java:322)
>
> at
> org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:128)
>
> at
> org.eclipse.emf.common.command.CompoundCommand.execute(Compo undCommand.java:268)
>
> at
> org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:91)
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:Teneo : JDOUserException while changing eContainer of an object
Next Topic:Custom validation
Goto Forum:
  


Current Time: Thu Apr 25 07:45:52 GMT 2024

Powered by FUDForum. Page generated in 0.02981 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top