Detach an entity from JPA/EJB3 persistence context

后端 未结 14 2135
面向向阳花
面向向阳花 2020-12-13 03:26

What would be the easiest way to detach a specific JPA Entity Bean that was acquired through an EntityManager. Alternatively, could I have a query return detached objects in

14条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 04:14

    I think you can also use method EntityManager.refresh(Object o) if primary key of the entity has not been changed. This method will restore original state of the entity.

提交回复
热议问题