| EMF Compare & ChangeDescription on Teneo/Database backed EMF objects [message #619182] |
Thu, 05 June 2008 15:47 |
Eclipse User |
|
|
|
Hi all,
This is really a theoretical concern that I want to put in your brains,
more than a specific bug. That said, I'm worried that the current
implementation of ChangeDescription is going to bite me if I use it as
it is.
I've just recorded a ChangeDescription on an object I held in my client
tier. The change description has a part that looks like this:
<value featureName="contactList">
<listChanges kind="REMOVE" index="4"/>
</value>
On the server I receive the change description, load the referenced
object out of the database and get ready to apply the change to the
Teneo backed object.
But here's the rub: Teneo/Hibernate does NOT guarantee that the objects
in the child list will be in the same order each time it is loaded from
the DB! (unlike a filesystem file that is the same each time you load
it) I can force Teneo to track the child-object-order but that means
adding a column to the database and sorting by that column when I
populate the list. Since my EMF objects are sitting on top of a legacy
database I can't easily do that plus it's a lot of error prone work to
make sure that's done correctly for every child list in the data model.
So now if I apply the change I'm going to delete whatever child object
happens to be in position 4 even though the order of the list may have
been shuffled. Oops.
Here's a possible solution: Database backed objects should all have an
@Id member in them. If the listChanges tag contained the value of the
ID column whenever it is present then we could use these
ChangeDescriptions on DB backed objects and be safe. As it is,
ChangeDescription + Teneo backed EMF = potentially lost data unless your
Teneo annotations are very specific and carefully checked.
Is that analysis correct, or does Ed have some magic up his sleeve?
Thanks all,
Jason Henriksen
|
|
|
Powered by
FUDForum. Page generated in 0.02950 seconds