问题:
EntityManager.merge()
can insert new objects and update existing ones. EntityManager.merge()
可以插入新对象并更新现有对象。
Why would one want to use persist()
(which can only create new objects)? 为什么要使用persist()
(只能创建新对象)?
解决方案:
参考一: https://stackoom.com/question/4ULw/JPA-EntityManager-为什么在merge-上使用persist参考二: https://oldbug.net/q/4ULw/JPA-EntityManager-Why-use-persist-over-merge
来源:oschina
链接:https://my.oschina.net/u/4432649/blog/4318385