[Teneo] Problems with EMF delete [message #420662] |
Mon, 07 July 2008 04:42  |
Eclipse User |
|
|
|
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 #420716 is a reply to message #420690] |
Tue, 08 July 2008 11:38   |
Eclipse User |
|
|
|
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 #420766 is a reply to message #420717] |
Thu, 10 July 2008 05:12  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.04115 seconds