mhgrove / Empire

JPA implementation for RDF
http://groups.google.com/group/empire-rdf/
Apache License 2.0
98 stars 34 forks source link

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

Closed mhgrove closed 12 years ago

mhgrove commented 12 years ago

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.