Detach an entity from JPA/EJB3 persistence context

后端 未结 14 2106
面向向阳花
面向向阳花 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条回答
  •  自闭症患者
    2020-12-13 04:09

    If using EclipseLink you also have the options,

    Use the Query hint, eclipselink.maintain-cache"="false - all returned objects will be detached.

    Use the EclipseLink JpaEntityManager copy() API to copy the object to the desired depth.

提交回复
热议问题