【发布时间】:2018-08-08 11:03:15
【问题描述】:
我有这样的代码
private Identifiable updateEntityInternal(JPABaseEntity entity) {
Identifiable updated = null;
try {
updated = em.merge(entity);
em.flush();
据我了解 em.merge 创建新实体,将状态从“旧”实体复制到新实体,管理新实体,分离“旧”实体。
我需要从实体中检索一些属性(数组、惰性初始化)。
如果我填充到此 api 的实体已经分离,会发生什么。这是否意味着在合并(复制状态)时它无法从我传递的实体中检索数组,因为它是分离的?那么合并后的新托管实体不会有这个数组吗?
【问题讨论】:
标签: hibernate jpa entitymanager openjpa