Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Texo deserialization messes up List order(When deserializing an object containing List of references using Texo, order is lost)
Texo deserialization messes up List order [message #1658006] Sun, 08 March 2015 06:12 Go to next message
Vinay Vasudeva Rao is currently offline Vinay Vasudeva RaoFriend
Messages: 2
Registered: March 2015
Junior Member
In my application, I have 2 entities 'A' and 'B' that have a many-to-many relationship. The order of references to 'B' in the entity 'A' is very important. So, this is modeled as an ordered reference (with @OrderColumn annotation) and results in a List<B> objects (instead of Set). (However in the other
side of the relationship, the order is not important and it is a Set).
Storing and retrieving List of 'B' references in an 'A' object is working fine. The order is properly maintained.

However, the order seems to go haywire when we serialize and deserialize these objects using Texo.

When the objects are serialized using Texo, the resultant XMI file seems to have the references of 'B' in the right order for objects of type 'A'. I verified this by opening the XMI file in an editor and checking the order of references.
I am using 'org.eclipse.emf.texo.xml.ModelXMLSaver' to serialize the objects into an XMI.

Then, this XMI file is used in a different application. There this XMI file is deserialized using Texo to get the list of objects. The 'org.eclipse.emf.texo.xml.ModelXMLLoader.read()' method is used to read the List<Objects> from the XMI file. In this, for every object of type 'A'. I see that the order of references of 'B' is messed up.

For example, say an object of type 'A' has references to 'B' objects with ids - 1,2,3,4 & 5. After serialization and deserialization as mentioned above, the order of 'B' references in the 'A' object will be 4,1,2,3,5 (or some other random/messed up order).

Is this a bug in Texo? Or am I using this incorrectly? Please let me know what I can do to maintain the order of references (for List of objects).

Currently, I am using Texo version '0.1.0-v201310021216'. I even migrated to version '0.9.0-v201501182340', but the same issue persists in this version too.

PS: I am posting this the second time since the first post did not appear in the forums even after 2 days!
Re: Texo deserialization messes up List order [message #1661229 is a reply to message #1658006] Mon, 09 March 2015 14:38 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Vinay,
Texo converts xml/xmi to EMF objects and then this to Texo objects. I checked this case and indeed afaics the order can
get mixed up in case of many-to-many as the conversion from EMF --> Texo sets the many-to-many from one of the sides, so
it can get to become arbitrary.

Can you enter a bugzilla for this? I can see if/how I can solve it by checking the order afterwards and making sure that
the order is repaired. I see I did this correctly for the Texo --> EMF but not for the EMF --> Texo conversion.

gr. Martin

PS: I also notice that sometimes the newsgroup messages do not get through to the forums...

On 09-03-15 14:48, Vinay Vasudeva Rao wrote:
> In my application, I have 2 entities 'A' and 'B' that have a many-to-many relationship. The order of references to 'B'
> in the entity 'A' is very important. So, this is modeled as an ordered reference (with @OrderColumn annotation) and
> results in a List<B> objects (instead of Set). (However in the other side of the relationship, the order is not
> important and it is a Set).
> Storing and retrieving List of 'B' references in an 'A' object is working fine. The order is properly maintained.
>
> However, the order seems to go haywire when we serialize and deserialize these objects using Texo.
>
> When the objects are serialized using Texo, the resultant XMI file seems to have the references of 'B' in the right
> order for objects of type 'A'. I verified this by opening the XMI file in an editor and checking the order of references.
> I am using 'org.eclipse.emf.texo.xml.ModelXMLSaver' to serialize the objects into an XMI.
>
> Then, this XMI file is used in a different application. There this XMI file is deserialized using Texo to get the list
> of objects. The 'org.eclipse.emf.texo.xml.ModelXMLLoader.read()' method is used to read the List<Objects> from the XMI
> file. In this, for every object of type 'A'. I see that the order of references of 'B' is messed up.
>
> For example, say an object of type 'A' has references to 'B' objects with ids - 1,2,3,4 & 5. After serialization and
> deserialization as mentioned above, the order of 'B' references in the 'A' object will be 4,1,2,3,5 (or some other
> random/messed up order).
>
> Is this a bug in Texo? Or am I using this incorrectly? Please let me know what I can do to maintain the order of
> references (for List of objects).
>
> Currently, I am using Texo version '0.1.0-v201310021216'. I even migrated to version '0.9.0-v201501182340', but the same
> issue persists in this version too.
>
> PS: I am posting this the second time since the first post did not appear in the forums even after 2 days!


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Texo deserialization messes up List order [message #1661273 is a reply to message #1661229] Mon, 09 March 2015 15:03 Go to previous messageGo to next message
Vinay Vasudeva Rao is currently offline Vinay Vasudeva RaoFriend
Messages: 2
Registered: March 2015
Junior Member
Thanks for the reply Martin.
I have filed a bug 461726 on bugzilla.
I tried to post a link here. But the editor does not allow as I have fewer than 5 posts.
I hope you see the bug.
Re: Texo deserialization messes up List order [message #1661353 is a reply to message #1661273] Mon, 09 March 2015 15:40 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
I see it, will be solved this week, will update the bugzilla when I publish a new build.

gr. Martin

On 09-03-15 16:03, Vinay Vasudeva Rao wrote:
> Thanks for the reply Martin.
> I have filed a bug 461726 on bugzilla. I tried to post a link here. But the editor does not allow as I have fewer than 5
> posts.
> I hope you see the bug.


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:[EcoreTools] damaged .aird file?
Next Topic:[Edapt] Feature not found
Goto Forum:
  


Current Time: Thu Apr 25 23:46:06 GMT 2024

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

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

Back to the top