I am working on an spring-hibernate-envers application. After lot of googling things are finally working for me but i have still got couple of questions.
Earlier i was using
saveOrUpdate
for saving or updating entities. But when working with envers it was throwing anonUniqueObject
exception. So i usedmerge
instead and it worked. Is it right to use merge for this? Doesmerge
inserts new objects to db?I tried following code:
entity=merge(entity); saveOrUpdate(entity);
This also worked. Is it the right way? And also i am curious that why saveOrUpdate
is not throwing any error now.