mhgrove/Empire

re-using a generated object in merge can result in duplicated triples

mhgrove opened this issue · 0 comments

If you create a generated object, persist it, change it, and then merge the same object back to the EntityManager you can end up with duplicated triples because the EntityManager thinks you've never saved the object before and does not delete the pre-existing triples.

We can add a case to try and catch this in merge, if we dont know about the source triples from EmpireGenerated, grab them from the db. This is probably not strictly right since those could be out of sync w/ the original state of the object, but i think its better than duplicated triples.

Correct usage would be to call refresh on the object after persist before you modify and merge.