JPA EntityManager:爲何在merge()上使用persist()? - JPA EntityManager: Why use persist() over merge()?

問題:

EntityManager.merge() can insert new objects and update existing ones. EntityManager.merge()能夠插入新對象並更新現有對象。 spa

Why would one want to use persist() (which can only create new objects)? 爲何要使用persist() (只能建立新對象)? .net


解決方案:

參考一: https://stackoom.com/question/4ULw/JPA-EntityManager-爲何在merge-上使用persist
參考二: https://oldbug.net/q/4ULw/JPA-EntityManager-Why-use-persist-over-merge
相關文章
相關標籤/搜索