Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » [Teneo] problem went copying with EcoreUtil.Copier
| | | | | |
Re: [Teneo] problem went copying with EcoreUtil.Copier [message #103048 is a reply to message #103038] |
Fri, 16 November 2007 22:18 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Put a conditional breakpoint at the location of the NPE and check the type of the owner and the
efeature.
gr. Martin
Mark Geib wrote:
> Martin,
>
> How do I tell what collection is causing the problem at the point of the
> exception.?
>
> Mark.
>
> Martin Taal wrote:
>> Ok, then can you check the contents of the database to see if the
>> index number of this collection has any 'holes' (so there are records
>> with index number 1,2,3 and then 5 and 6 for example).
>>
>> gr. Martin
>>
>> Mark Geib wrote:
>>> eObject is null.
>>>
>>> Mark.
>>>
>>> Martin Taal wrote:
>>>> In my version of emf, line 303 is this:
>>>> return eObject.eIsProxy() ?
>>>> owner.eResolveProxy((InternalEObject)eObject) : eObject;
>>>>
>>>> Can you see which is null eObject or owner?
>>>>
>>>> gr. Martin
>>>>
>>>> Mark Geib wrote:
>>>>> Sorry, but I am running Teneo 0.8020070330xxxx and Eclipse 3.3.1
>>>>> EMF 2.3.0
>>>>>
>>>>>
>>>>> Mark Geib wrote:
>>>>>> I am trying to save a complete Teneo hosted resource using the
>>>>>> EcoreUtil.Copier class. When I call copier.copyReferences() I get
>>>>>> the following exception... I want to export to XMI/XML any ideas.?
>>>>>>
>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolveProxy (DelegatingEcoreEList.java:303)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolve(Dele gatingEcoreEList.java:264)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList.get(DelegatingEL ist.java:394)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.doNext (DelegatingEList.java:1073)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.next(D elegatingEList.java:1060)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:445)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at srd.util.xml2teneo.Import2Teneo.main(Import2Teneo.java:110)
>>>>
>>>>
>>
>>
--
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] problem went copying with EcoreUtil.Copier [message #103118 is a reply to message #103105] |
Mon, 19 November 2007 18:28 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Mark,
It should be something ending on IDX in the child table (or join table) with the name of the eclass
and efeature of the collection as a prefix.
gr. Martin
Mark Geib wrote:
> Martin,
>
> OK, I have written a small routine to 'walk' through all the objects and
> that way I found the offending collection. So, what is the column name
> of the index I need to look for holes in pls.?
>
> Mark.
>
> Martin Taal wrote:
>> Ok, then can you check the contents of the database to see if the
>> index number of this collection has any 'holes' (so there are records
>> with index number 1,2,3 and then 5 and 6 for example).
>>
>> gr. Martin
>>
>> Mark Geib wrote:
>>> eObject is null.
>>>
>>> Mark.
>>>
>>> Martin Taal wrote:
>>>> In my version of emf, line 303 is this:
>>>> return eObject.eIsProxy() ?
>>>> owner.eResolveProxy((InternalEObject)eObject) : eObject;
>>>>
>>>> Can you see which is null eObject or owner?
>>>>
>>>> gr. Martin
>>>>
>>>> Mark Geib wrote:
>>>>> Sorry, but I am running Teneo 0.8020070330xxxx and Eclipse 3.3.1
>>>>> EMF 2.3.0
>>>>>
>>>>>
>>>>> Mark Geib wrote:
>>>>>> I am trying to save a complete Teneo hosted resource using the
>>>>>> EcoreUtil.Copier class. When I call copier.copyReferences() I get
>>>>>> the following exception... I want to export to XMI/XML any ideas.?
>>>>>>
>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolveProxy (DelegatingEcoreEList.java:303)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolve(Dele gatingEcoreEList.java:264)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList.get(DelegatingEL ist.java:394)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.doNext (DelegatingEList.java:1073)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.next(D elegatingEList.java:1060)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:445)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at srd.util.xml2teneo.Import2Teneo.main(Import2Teneo.java:110)
>>>>
>>>>
>>
>>
--
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] problem went copying with EcoreUtil.Copier [message #103171 is a reply to message #103143] |
Tue, 20 November 2007 09:04 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Mark,
Yes, this case (of holes in the index) can occur in the following case:
Assume a type A which has a list of B's (non-containment and uni-directional association). In a
relational db this can be modeled using a join table between A and B or by using foreign-keys in the
B-table (pointing to A). In the latter case you loose referential constraint checking (on db-level)
when removing B (this is a symptom of the fact that references in a relational db can be directed
the other way than in java).
Let me illustrate this with an example: if an instance A1 has three B's: B0, B1, B2 (on indexes 0, 1
and 2 in the list). Then when I store A1 there will be one record in table-A and three records in
the B-table with an index column with values 0, 1 and 2 and a foreign-key column to the one A
record. Now to re-produce the exception you are getting: start a transaction and query for the B
objects (without reading A) and remove B1. What happens is that the B1 record is removed from the B
table. Commit the transaction. In the B-table two records remain with indexes 0 and 2. Begin a new
transaction then read A and open the list of B's. This will read B0 in index position 0 in the list
and B2 in index position 2 in the list. So index 1 stays empty and leaves a null value in the list.
There are different ways to handle this:
- Don't use list's on db level, so map lists (for which the above can occur) as bags (can be done
using an annotation).
- Perform programmatic referential checking before removing an object (the datastore has a
getCrossReferencers method to facilitate this)
gr. Martin
Mark Geib wrote:
> Martin,
>
> I was able to resolve the original issue by finding the offending row in
> the database and deleting...however, now I am getting a similar
> exception later in the copy process. The stack is
>
>
> Exception in thread "main" java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolveProxy (DelegatingEcoreEList.java:303)
>
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolve(Dele gatingEcoreEList.java:264)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.get(DelegatingEL ist.java:394)
> at
> org.eclipse.emf.common.util.DelegatingEList$EIterator.doNext (DelegatingEList.java:1073)
>
> at
> org.eclipse.emf.common.util.DelegatingEList$EIterator.next(D elegatingEList.java:1060)
>
> at
> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyReference(Ec oreUtil.java:710)
>
> at
> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyReferences(E coreUtil.java:634)
>
> at srd.util.xml2teneo.Import2Teneo.main(Import2Teneo.java:139)
>
>
> I can find the parent/owner object and then I added a call to clear all
> the references from that object and now get ...
>
>
> Exception in thread "main" java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.inverseRemov e(DelegatingEcoreEList.java:421)
>
> at
> org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.clear(DelegatingNotifyingListImpl.java:1118)
>
>
> I have been unable to find anything inconsistent with this collection.
>
> Mark.
>
>
>
>
>
>
>
>
>
> Martin Taal wrote:
>> Ok, then can you check the contents of the database to see if the
>> index number of this collection has any 'holes' (so there are records
>> with index number 1,2,3 and then 5 and 6 for example).
>>
>> gr. Martin
>>
>> Mark Geib wrote:
>>> eObject is null.
>>>
>>> Mark.
>>>
>>> Martin Taal wrote:
>>>> In my version of emf, line 303 is this:
>>>> return eObject.eIsProxy() ?
>>>> owner.eResolveProxy((InternalEObject)eObject) : eObject;
>>>>
>>>> Can you see which is null eObject or owner?
>>>>
>>>> gr. Martin
>>>>
>>>> Mark Geib wrote:
>>>>> Sorry, but I am running Teneo 0.8020070330xxxx and Eclipse 3.3.1
>>>>> EMF 2.3.0
>>>>>
>>>>>
>>>>> Mark Geib wrote:
>>>>>> I am trying to save a complete Teneo hosted resource using the
>>>>>> EcoreUtil.Copier class. When I call copier.copyReferences() I get
>>>>>> the following exception... I want to export to XMI/XML any ideas.?
>>>>>>
>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolveProxy (DelegatingEcoreEList.java:303)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolve(Dele gatingEcoreEList.java:264)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList.get(DelegatingEL ist.java:394)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.doNext (DelegatingEList.java:1073)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.next(D elegatingEList.java:1060)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:445)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at srd.util.xml2teneo.Import2Teneo.main(Import2Teneo.java:110)
>>>>
>>>>
>>
>>
--
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] problem went copying with EcoreUtil.Copier [message #612577 is a reply to message #103038] |
Fri, 16 November 2007 22:18 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Put a conditional breakpoint at the location of the NPE and check the type of the owner and the
efeature.
gr. Martin
Mark Geib wrote:
> Martin,
>
> How do I tell what collection is causing the problem at the point of the
> exception.?
>
> Mark.
>
> Martin Taal wrote:
>> Ok, then can you check the contents of the database to see if the
>> index number of this collection has any 'holes' (so there are records
>> with index number 1,2,3 and then 5 and 6 for example).
>>
>> gr. Martin
>>
>> Mark Geib wrote:
>>> eObject is null.
>>>
>>> Mark.
>>>
>>> Martin Taal wrote:
>>>> In my version of emf, line 303 is this:
>>>> return eObject.eIsProxy() ?
>>>> owner.eResolveProxy((InternalEObject)eObject) : eObject;
>>>>
>>>> Can you see which is null eObject or owner?
>>>>
>>>> gr. Martin
>>>>
>>>> Mark Geib wrote:
>>>>> Sorry, but I am running Teneo 0.8020070330xxxx and Eclipse 3.3.1
>>>>> EMF 2.3.0
>>>>>
>>>>>
>>>>> Mark Geib wrote:
>>>>>> I am trying to save a complete Teneo hosted resource using the
>>>>>> EcoreUtil.Copier class. When I call copier.copyReferences() I get
>>>>>> the following exception... I want to export to XMI/XML any ideas.?
>>>>>>
>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolveProxy (DelegatingEcoreEList.java:303)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolve(Dele gatingEcoreEList.java:264)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList.get(DelegatingEL ist.java:394)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.doNext (DelegatingEList.java:1073)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.next(D elegatingEList.java:1060)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:445)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at srd.util.xml2teneo.Import2Teneo.main(Import2Teneo.java:110)
>>>>
>>>>
>>
>>
--
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] problem went copying with EcoreUtil.Copier [message #612588 is a reply to message #103105] |
Mon, 19 November 2007 18:28 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Mark,
It should be something ending on IDX in the child table (or join table) with the name of the eclass
and efeature of the collection as a prefix.
gr. Martin
Mark Geib wrote:
> Martin,
>
> OK, I have written a small routine to 'walk' through all the objects and
> that way I found the offending collection. So, what is the column name
> of the index I need to look for holes in pls.?
>
> Mark.
>
> Martin Taal wrote:
>> Ok, then can you check the contents of the database to see if the
>> index number of this collection has any 'holes' (so there are records
>> with index number 1,2,3 and then 5 and 6 for example).
>>
>> gr. Martin
>>
>> Mark Geib wrote:
>>> eObject is null.
>>>
>>> Mark.
>>>
>>> Martin Taal wrote:
>>>> In my version of emf, line 303 is this:
>>>> return eObject.eIsProxy() ?
>>>> owner.eResolveProxy((InternalEObject)eObject) : eObject;
>>>>
>>>> Can you see which is null eObject or owner?
>>>>
>>>> gr. Martin
>>>>
>>>> Mark Geib wrote:
>>>>> Sorry, but I am running Teneo 0.8020070330xxxx and Eclipse 3.3.1
>>>>> EMF 2.3.0
>>>>>
>>>>>
>>>>> Mark Geib wrote:
>>>>>> I am trying to save a complete Teneo hosted resource using the
>>>>>> EcoreUtil.Copier class. When I call copier.copyReferences() I get
>>>>>> the following exception... I want to export to XMI/XML any ideas.?
>>>>>>
>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolveProxy (DelegatingEcoreEList.java:303)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolve(Dele gatingEcoreEList.java:264)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList.get(DelegatingEL ist.java:394)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.doNext (DelegatingEList.java:1073)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.next(D elegatingEList.java:1060)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:445)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at srd.util.xml2teneo.Import2Teneo.main(Import2Teneo.java:110)
>>>>
>>>>
>>
>>
--
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] problem went copying with EcoreUtil.Copier [message #612597 is a reply to message #103143] |
Tue, 20 November 2007 09:04 |
Martin Taal Messages: 5468 Registered: July 2009 |
Senior Member |
|
|
Mark,
Yes, this case (of holes in the index) can occur in the following case:
Assume a type A which has a list of B's (non-containment and uni-directional association). In a
relational db this can be modeled using a join table between A and B or by using foreign-keys in the
B-table (pointing to A). In the latter case you loose referential constraint checking (on db-level)
when removing B (this is a symptom of the fact that references in a relational db can be directed
the other way than in java).
Let me illustrate this with an example: if an instance A1 has three B's: B0, B1, B2 (on indexes 0, 1
and 2 in the list). Then when I store A1 there will be one record in table-A and three records in
the B-table with an index column with values 0, 1 and 2 and a foreign-key column to the one A
record. Now to re-produce the exception you are getting: start a transaction and query for the B
objects (without reading A) and remove B1. What happens is that the B1 record is removed from the B
table. Commit the transaction. In the B-table two records remain with indexes 0 and 2. Begin a new
transaction then read A and open the list of B's. This will read B0 in index position 0 in the list
and B2 in index position 2 in the list. So index 1 stays empty and leaves a null value in the list.
There are different ways to handle this:
- Don't use list's on db level, so map lists (for which the above can occur) as bags (can be done
using an annotation).
- Perform programmatic referential checking before removing an object (the datastore has a
getCrossReferencers method to facilitate this)
gr. Martin
Mark Geib wrote:
> Martin,
>
> I was able to resolve the original issue by finding the offending row in
> the database and deleting...however, now I am getting a similar
> exception later in the copy process. The stack is
>
>
> Exception in thread "main" java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolveProxy (DelegatingEcoreEList.java:303)
>
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolve(Dele gatingEcoreEList.java:264)
>
> at
> org.eclipse.emf.common.util.DelegatingEList.get(DelegatingEL ist.java:394)
> at
> org.eclipse.emf.common.util.DelegatingEList$EIterator.doNext (DelegatingEList.java:1073)
>
> at
> org.eclipse.emf.common.util.DelegatingEList$EIterator.next(D elegatingEList.java:1060)
>
> at
> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyReference(Ec oreUtil.java:710)
>
> at
> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyReferences(E coreUtil.java:634)
>
> at srd.util.xml2teneo.Import2Teneo.main(Import2Teneo.java:139)
>
>
> I can find the parent/owner object and then I added a call to clear all
> the references from that object and now get ...
>
>
> Exception in thread "main" java.lang.NullPointerException
> at
> org.eclipse.emf.ecore.util.DelegatingEcoreEList.inverseRemov e(DelegatingEcoreEList.java:421)
>
> at
> org.eclipse.emf.common.notify.impl.DelegatingNotifyingListIm pl.clear(DelegatingNotifyingListImpl.java:1118)
>
>
> I have been unable to find anything inconsistent with this collection.
>
> Mark.
>
>
>
>
>
>
>
>
>
> Martin Taal wrote:
>> Ok, then can you check the contents of the database to see if the
>> index number of this collection has any 'holes' (so there are records
>> with index number 1,2,3 and then 5 and 6 for example).
>>
>> gr. Martin
>>
>> Mark Geib wrote:
>>> eObject is null.
>>>
>>> Mark.
>>>
>>> Martin Taal wrote:
>>>> In my version of emf, line 303 is this:
>>>> return eObject.eIsProxy() ?
>>>> owner.eResolveProxy((InternalEObject)eObject) : eObject;
>>>>
>>>> Can you see which is null eObject or owner?
>>>>
>>>> gr. Martin
>>>>
>>>> Mark Geib wrote:
>>>>> Sorry, but I am running Teneo 0.8020070330xxxx and Eclipse 3.3.1
>>>>> EMF 2.3.0
>>>>>
>>>>>
>>>>> Mark Geib wrote:
>>>>>> I am trying to save a complete Teneo hosted resource using the
>>>>>> EcoreUtil.Copier class. When I call copier.copyReferences() I get
>>>>>> the following exception... I want to export to XMI/XML any ideas.?
>>>>>>
>>>>>> Exception in thread "main" java.lang.NullPointerException
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolveProxy (DelegatingEcoreEList.java:303)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.DelegatingEcoreEList.resolve(Dele gatingEcoreEList.java:264)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList.get(DelegatingEL ist.java:394)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.doNext (DelegatingEList.java:1073)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.common.util.DelegatingEList$EIterator.next(D elegatingEList.java:1060)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:445)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyAll(EcoreUti l.java:447)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copyContainment( EcoreUtil.java:556)
>>>>>>
>>>>>> at
>>>>>> org.eclipse.emf.ecore.util.EcoreUtil$Copier.copy(EcoreUtil.j ava:477)
>>>>>> at srd.util.xml2teneo.Import2Teneo.main(Import2Teneo.java:110)
>>>>
>>>>
>>
>>
--
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
|
|
|
Goto Forum:
Current Time: Sat Aug 17 21:10:02 GMT 2024
Powered by FUDForum. Page generated in 0.07614 seconds
|