Why need detached entities in JPA?

前端 未结 6 585
礼貌的吻别
礼貌的吻别 2021-01-31 09:28

There are always so many questions related to issues with detached entities!

First, they often cause LazyInitializationException in Hibernate. Yes, there ar

6条回答
  •  囚心锁ツ
    2021-01-31 09:43

    For instance, suppose you have a RESTful interface with a method for retrieving an JSON-serialized object by its id to the caller and a method that receives an updated version of this object from the caller. An entity that passed through such serialization/deserialization will appear in a detached state.

    check this, and read 3.3 merge

提交回复
热议问题