HHH-6605: Fixing problems with lazy proxy initialization
This commit is contained in:
parent
89bb7ec175
commit
f434cd4311
|
@ -109,6 +109,8 @@ public abstract class BaseEnversEventListener implements EnversListener {
|
|||
HibernateProxy hibernateProxy = (HibernateProxy) value;
|
||||
toEntityName = session.bestGuessEntityName(value);
|
||||
id = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
|
||||
// We've got to initialize the object from the proxy to later read its state.
|
||||
value = Tools.getTargetFromProxy(session.getFactory(), hibernateProxy);
|
||||
} else {
|
||||
toEntityName = session.guessEntityName(value);
|
||||
|
||||
|
|
|
@ -55,7 +55,6 @@ public class CollectionChangeWorkUnit extends AbstractAuditWorkUnit implements A
|
|||
|
||||
public Map<String, Object> generateData(Object revisionData) {
|
||||
fillDataWithId(data, revisionData);
|
||||
resolveProxyIfNeeded();
|
||||
Map<String, Object> preGenerateData = new HashMap<String, Object>(data);
|
||||
verCfg.getEntCfg().get(getEntityName()).getPropertyMapper()
|
||||
.mapToMapFromEntity(sessionImplementor, data, entity, null);
|
||||
|
@ -67,12 +66,6 @@ public class CollectionChangeWorkUnit extends AbstractAuditWorkUnit implements A
|
|||
return data;
|
||||
}
|
||||
|
||||
private void resolveProxyIfNeeded() {
|
||||
if (entity instanceof HibernateProxy) {
|
||||
Tools.getTargetFromProxy(sessionImplementor.getFactory(), (HibernateProxy) entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void mergeCollectionModifiedData(Map<String, Object> data) {
|
||||
verCfg.getEntCfg().get(getEntityName()).getPropertyMapper()
|
||||
.mapModifiedFlagsToMapForCollectionChange(
|
||||
|
|
Loading…
Reference in New Issue