Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Teneo] Problems with EMF delete
[Teneo] Problems with EMF delete [message #420662] Mon, 07 July 2008 08:42 Go to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Hi!

We are using EMF with JPOX/Teneo to persist the model objects in a database.

For validation we use an adapter (derived from EContentAdapter) which is
attached to the resource as follows in the createModel() method of the EMF
editor:

// Add a live validation adapter to the resource
EContentAdapter liveValidationContentAdapter = new
LiveValidationContentAdapter();
resource.eAdapters().add(liveValidationContentAdapter);

In the EMF editor we try to delete a model object AGENT which contains an
EReference to another object SKILL.

When deleting this AGENT object the LiveValidationContentAdapter tries to
remove itself from the directly contained objects (from type SKILL), after
the AGENT was removed from the resource. Within the method
EContentAdapter#unsetTarget() the eIsSet() method from the AgentImpl class
is called for the feature SKILL. When trying to access SKILL
the following exception is thrown:
javax.jdo.JDOUserException: Cannot read fields from a deleted object

Could that be a bug in Teneo? Are there any known workarounds for that? I
have seen the documentation regarding validation at
http://www.elver.org/jpox/jpox_details.html#Validation, but that does not
seem to apply in this case.

Cheers,
Florian Hackenberger

--
DI Florian Hackenberger
florian@hackenberger.at
www.hackenberger.at
Re: [Teneo] Problems with EMF delete [message #420663 is a reply to message #420662] Mon, 07 July 2008 09:03 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Florian,
Is the exception thrown when calling eIsSet on Agent or when accessing the SKILL object itself?
Can you post the stacktrace and the relevant part of the jdo (describing the relation between agent
and skill)?

gr. Martin

DI Florian Hackenberger wrote:
> Hi!
>
> We are using EMF with JPOX/Teneo to persist the model objects in a database.
>
> For validation we use an adapter (derived from EContentAdapter) which is
> attached to the resource as follows in the createModel() method of the EMF
> editor:
>
> // Add a live validation adapter to the resource
> EContentAdapter liveValidationContentAdapter = new
> LiveValidationContentAdapter();
> resource.eAdapters().add(liveValidationContentAdapter);
>
> In the EMF editor we try to delete a model object AGENT which contains an
> EReference to another object SKILL.
>
> When deleting this AGENT object the LiveValidationContentAdapter tries to
> remove itself from the directly contained objects (from type SKILL), after
> the AGENT was removed from the resource. Within the method
> EContentAdapter#unsetTarget() the eIsSet() method from the AgentImpl class
> is called for the feature SKILL. When trying to access SKILL
> the following exception is thrown:
> javax.jdo.JDOUserException: Cannot read fields from a deleted object
>
> Could that be a bug in Teneo? Are there any known workarounds for that? I
> have seen the documentation regarding validation at
> http://www.elver.org/jpox/jpox_details.html#Validation, but that does not
> seem to apply in this case.
>
> Cheers,
> Florian Hackenberger
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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] Problems with EMF delete [message #420678 is a reply to message #420663] Mon, 07 July 2008 12:59 Go to previous messageGo to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:
> Is the exception thrown when calling eIsSet on Agent or when accessing the
> SKILL object itself? Can you post the stacktrace and the relevant part of
> the jdo (describing the relation between agent and skill)?
The exception is caused by a call to Agent::eIsSet with the feature
describing the relationship to SkillLevel (I misnomed it Skill in the
previous post).

I snipped irrelevant attributes from AgentImpl.

<class name="org.acoveo.callcenter.masterdata.impl.AgentImpl"
requires-extent="true" persistence-modifier="persistence-capable"
detachable="true" table="agent" identity-type="application">
<implements name="org.acoveo.callcenter.masterdata.Agent"/>
<inheritance strategy="new-table"/>
<version strategy="version-number" column="e_version"/>
<field name="skillLevels" persistence-modifier="persistent"
delete-action="restrict">
<collection
element-type="org.acoveo.callcenter.masterdata.impl.SkillLevelImpl "
dependent-element="true">
<extension vendor-name="jpox" key="cache-lazy-loading" value="true"/>
</collection>
<element>
<column name="agent_skilllevels_id" allows-null="true"/>
</element>
<order column="AGENT_SKILLLEVELS_IDX"/>
<foreign-key delete-action="cascade" update-action="cascade"
name="agent_skilllevels"/>
</field>
</class>

<class name="org.acoveo.callcenter.masterdata.impl.SkillLevelImpl"
requires-extent="true" persistence-modifier="persistence-capable"
detachable="true" table="skilllevel" identity-type="datastore">
<implements name="org.acoveo.callcenter.masterdata.SkillLevel"/>
<implements name="org.eclipse.emf.ecore.EObject"/>
<implements name="org.eclipse.emf.common.notify.Notifier"/>
<inheritance strategy="new-table"/>
<version strategy="version-number" column="e_version"/>
<field name="skill" persistence-modifier="persistent"
delete-action="restrict" null-value="none">
<foreign-key name="skilllevel_skill"/>
<column name="skill_skill_id" allows-null="true"/>
<extension vendor-name="jpox" key="implementation-classes"
value="org.acoveo.callcenter.masterdata.impl.SkillImpl"/>
</field>
<field name="level" persistence-modifier="persistent" null-value="none"/>
</class>

javax.jdo.JDOUserException: Cannot read fields from a deleted object
FailedObject:326
at
org.jpox.state.jdo.PersistentDeleted.transitionReadField(Per sistentDeleted.java:115)
at
org.jpox.state.StateManagerImpl.transitionReadField(StateMan agerImpl.java:3394)
at
org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1982)
at
org.acoveo.callcenter.masterdata.impl.AgentImpl.jdoGetskillL evels(AgentImpl.java)
at
org.acoveo.callcenter.masterdata.impl.AgentImpl.eIsSet(Agent Impl.java:467)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
at
org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImp l.hasNext(EContentsEList.java:427)
at
org.eclipse.emf.ecore.util.EContentAdapter.unsetTarget(ECont entAdapter.java:313)
at
org.eclipse.emf.ecore.util.EContentAdapter.unsetTarget(ECont entAdapter.java:287)
at
org.eclipse.emf.ecore.util.EContentAdapter.unsetTarget(ECont entAdapter.java:266)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.didRemove(BasicNotifierImpl.java:99)
at
org.eclipse.emf.common.util.BasicEList.remove(BasicEList.jav a:953)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.remove(BasicNotifierImpl.java:157)
at
org.eclipse.emf.common.util.BasicEList.remove(BasicEList.jav a:898)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.remove(BasicNotifierImpl.java:150)
at
org.eclipse.emf.ecore.util.EContentAdapter.removeAdapter(ECo ntentAdapter.java:357)
at
org.eclipse.emf.ecore.util.EContentAdapter.handleContainment (EContentAdapter.java:163)
at
org.eclipse.emf.ecore.util.EContentAdapter.selfAdapt(EConten tAdapter.java:80)
at
org.eclipse.emf.ecore.util.EContentAdapter.notifyChanged(ECo ntentAdapter.java:46)
at
org.acoveo.callcenter.masterdata.constraint.LiveValidationCo ntentAdapter.notifyChanged(LiveValidationContentAdapter.java :24)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
at
org.eclipse.emf.ecore.util.DelegatingEcoreEList.dispatchNoti fication(DelegatingEcoreEList.java:346)
at
org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.remove(DelegatingNotifyingListImpl.java:702)
at
org.eclipse.emf.edit.command.RemoveCommand.doExecute(RemoveC ommand.java:326)
at
org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:129)
at
org.eclipse.emf.common.command.CommandWrapper.execute(Comman dWrapper.java:180)
at
org.acoveo.callcenter.masterdata.presentation.SingleReferenc eDeleteCommand.compoundCommandExecute(SingleReferenceDeleteC ommand.java:62)
at
org.acoveo.callcenter.masterdata.presentation.SingleReferenc eDeleteCommand.execute(SingleReferenceDeleteCommand.java:152 )
at
org.acoveo.callcenter.masterdata.commands.AuthorisingWrapped Command.execute(AuthorisingWrappedCommand.java:58)
at
org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:92)
at
org.eclipse.emf.edit.ui.action.CommandActionHandler.run(Comm andActionHandler.java:92)
at
org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEv ent(BaseSelectionListenerAction.java:168)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:546)
at org.eclipse.jface.action.ActionContributionItem.access$2
(ActionContributionItem.java:490)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
at
org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3319)
................


--
DI Florian Hackenberger
florian@hackenberger.at
www.hackenberger.at
Re: [Teneo] Problems with EMF delete [message #420690 is a reply to message #420678] Mon, 07 July 2008 20:44 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Florian,
What is a bit strange is that the jdo remove is done when a resource is saved and not when an object
is removed from the resource. Can you track when the jdo remove takes place?

gr. Martin

DI Florian Hackenberger wrote:
> Martin Taal wrote:
>> Is the exception thrown when calling eIsSet on Agent or when accessing the
>> SKILL object itself? Can you post the stacktrace and the relevant part of
>> the jdo (describing the relation between agent and skill)?
> The exception is caused by a call to Agent::eIsSet with the feature
> describing the relationship to SkillLevel (I misnomed it Skill in the
> previous post).
>
> I snipped irrelevant attributes from AgentImpl.
>
> <class name="org.acoveo.callcenter.masterdata.impl.AgentImpl"
> requires-extent="true" persistence-modifier="persistence-capable"
> detachable="true" table="agent" identity-type="application">
> <implements name="org.acoveo.callcenter.masterdata.Agent"/>
> <inheritance strategy="new-table"/>
> <version strategy="version-number" column="e_version"/>
> <field name="skillLevels" persistence-modifier="persistent"
> delete-action="restrict">
> <collection
> element-type="org.acoveo.callcenter.masterdata.impl.SkillLevelImpl "
> dependent-element="true">
> <extension vendor-name="jpox" key="cache-lazy-loading" value="true"/>
> </collection>
> <element>
> <column name="agent_skilllevels_id" allows-null="true"/>
> </element>
> <order column="AGENT_SKILLLEVELS_IDX"/>
> <foreign-key delete-action="cascade" update-action="cascade"
> name="agent_skilllevels"/>
> </field>
> </class>
>
> <class name="org.acoveo.callcenter.masterdata.impl.SkillLevelImpl"
> requires-extent="true" persistence-modifier="persistence-capable"
> detachable="true" table="skilllevel" identity-type="datastore">
> <implements name="org.acoveo.callcenter.masterdata.SkillLevel"/>
> <implements name="org.eclipse.emf.ecore.EObject"/>
> <implements name="org.eclipse.emf.common.notify.Notifier"/>
> <inheritance strategy="new-table"/>
> <version strategy="version-number" column="e_version"/>
> <field name="skill" persistence-modifier="persistent"
> delete-action="restrict" null-value="none">
> <foreign-key name="skilllevel_skill"/>
> <column name="skill_skill_id" allows-null="true"/>
> <extension vendor-name="jpox" key="implementation-classes"
> value="org.acoveo.callcenter.masterdata.impl.SkillImpl"/>
> </field>
> <field name="level" persistence-modifier="persistent" null-value="none"/>
> </class>
>
> javax.jdo.JDOUserException: Cannot read fields from a deleted object
> FailedObject:326
> at
> org.jpox.state.jdo.PersistentDeleted.transitionReadField(Per sistentDeleted.java:115)
> at
> org.jpox.state.StateManagerImpl.transitionReadField(StateMan agerImpl.java:3394)
> at
> org.jpox.state.StateManagerImpl.isLoaded(StateManagerImpl.ja va:1982)
> at
> org.acoveo.callcenter.masterdata.impl.AgentImpl.jdoGetskillL evels(AgentImpl.java)
> at
> org.acoveo.callcenter.masterdata.impl.AgentImpl.eIsSet(Agent Impl.java:467)
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:1225)
> at
> org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImp l.hasNext(EContentsEList.java:427)
> at
> org.eclipse.emf.ecore.util.EContentAdapter.unsetTarget(ECont entAdapter.java:313)
> at
> org.eclipse.emf.ecore.util.EContentAdapter.unsetTarget(ECont entAdapter.java:287)
> at
> org.eclipse.emf.ecore.util.EContentAdapter.unsetTarget(ECont entAdapter.java:266)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.didRemove(BasicNotifierImpl.java:99)
> at
> org.eclipse.emf.common.util.BasicEList.remove(BasicEList.jav a:953)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.remove(BasicNotifierImpl.java:157)
> at
> org.eclipse.emf.common.util.BasicEList.remove(BasicEList.jav a:898)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapte rList.remove(BasicNotifierImpl.java:150)
> at
> org.eclipse.emf.ecore.util.EContentAdapter.removeAdapter(ECo ntentAdapter.java:357)
> at
> org.eclipse.emf.ecore.util.EContentAdapter.handleContainment (EContentAdapter.java:163)
> at
> org.eclipse.emf.ecore.util.EContentAdapter.selfAdapt(EConten tAdapter.java:80)
> at
> org.eclipse.emf.ecore.util.EContentAdapter.notifyChanged(ECo ntentAdapter.java:46)
> at
> org.acoveo.callcenter.masterdata.constraint.LiveValidationCo ntentAdapter.notifyChanged(LiveValidationContentAdapter.java :24)
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:247)
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.dispatchNoti fication(DelegatingEcoreEList.java:346)
> at
> org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.remove(DelegatingNotifyingListImpl.java:702)
> at
> org.eclipse.emf.edit.command.RemoveCommand.doExecute(RemoveC ommand.java:326)
> at
> org.eclipse.emf.edit.command.AbstractOverrideableCommand.exe cute(AbstractOverrideableCommand.java:129)
> at
> org.eclipse.emf.common.command.CommandWrapper.execute(Comman dWrapper.java:180)
> at
> org.acoveo.callcenter.masterdata.presentation.SingleReferenc eDeleteCommand.compoundCommandExecute(SingleReferenceDeleteC ommand.java:62)
> at
> org.acoveo.callcenter.masterdata.presentation.SingleReferenc eDeleteCommand.execute(SingleReferenceDeleteCommand.java:152 )
> at
> org.acoveo.callcenter.masterdata.commands.AuthorisingWrapped Command.execute(AuthorisingWrappedCommand.java:58)
> at
> org.eclipse.emf.common.command.BasicCommandStack.execute(Bas icCommandStack.java:92)
> at
> org.eclipse.emf.edit.ui.action.CommandActionHandler.run(Comm andActionHandler.java:92)
> at
> org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEv ent(BaseSelectionListenerAction.java:168)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:546)
> at org.eclipse.jface.action.ActionContributionItem.access$2
> (ActionContributionItem.java:490)
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
> at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3319)
> ................
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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] Problems with EMF delete [message #420716 is a reply to message #420690] Tue, 08 July 2008 15:38 Go to previous messageGo to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:
> What is a bit strange is that the jdo remove is done when a resource is
> saved and not when an object is removed from the resource. Can you track
> when the jdo remove takes place?
I don't think that the object is removed from the database, it is probably
simply detached from the persistence backend. The relevant stack trace is:

EListWrapper<E>.didRemove(int, E) line: 741
EListWrapper<E>(DelegatingEList<E>).remove(int) line: 810
EListWrapper<E>(DelegatingNotifyingListImpl<E>).doRemove(int) line: 745
EListWrapper<E>(DelegatingNotifyingListImpl<E>).remove(int) line: 696
RemoveCommand.doExecute() line: 326
RemoveCommand(AbstractOverrideableCommand).execute() line: 129

EListWrapper is org.eclipse.emf.teneo.jpox.elist.EListWrapper

and it calls:
obj = jdoDelegate.remove(index);
within didRemove(), where jdoDelegate is an org.jpox.sco.ArrayList

As far as I can tell from the ArrayList documentation, a call to remove
detaches the object from the list (which is the list containing all
directly displayed model objects in my resource) and probably from the
persistence manager.

Before this call the object looks like this:
org.acoveo.callcenter.masterdata.impl.AgentImpl@1bb02e (name: test, id: 31)
(agentId: 1234, password: 4321, voicemailboxTimeout: 20, email: ,
sendVoicemailToEmail: true)

afterward I get the following message in the debugger when trying to display
it:
com.sun.jdi.InvocationException occurred invoking method.

Cheers,
Florian

--
DI Florian Hackenberger
florian@hackenberger.at
www.hackenberger.at
Re: [Teneo] Problems with EMF delete [message #420717 is a reply to message #420690] Tue, 08 July 2008 15:39 Go to previous messageGo to next message
Florian Hackenberger is currently offline Florian HackenbergerFriend
Messages: 123
Registered: July 2009
Senior Member
Martin Taal wrote:
> What is a bit strange is that the jdo remove is done when a resource is
> saved and not when an object is removed from the resource. Can you track
> when the jdo remove takes place?
I forgot to mention that SkillLevel is one of the classes which is not
contained in the elements list of my root object. It is only contained
within Agent.

Cheers,
Florian
--
DI Florian Hackenberger
florian@hackenberger.at
www.hackenberger.at
Re: [Teneo] Problems with EMF delete [message #420766 is a reply to message #420717] Thu, 10 July 2008 09:12 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Florian,
Sorry for my late reply. The agency is removed from a container object which holds it, correct? So
not from the resource contents.

Can you send me a testcase which mimicks this? Maybe we have to detach the object before deleting it
so that the members are accessible.

gr. Martin

DI Florian Hackenberger wrote:
> Martin Taal wrote:
>> What is a bit strange is that the jdo remove is done when a resource is
>> saved and not when an object is removed from the resource. Can you track
>> when the jdo remove takes place?
> I forgot to mention that SkillLevel is one of the classes which is not
> contained in the elements list of my root object. It is only contained
> within Agent.
>
> Cheers,
> Florian




--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
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:Adding "create child" to project explorer
Next Topic:newly created EMF editor does not find the document element's class
Goto Forum:
  


Current Time: Thu Apr 25 17:42:40 GMT 2024

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

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

Back to the top