HHH-7681 - Fix setting fake bidirectional attributes to null on collection change work units.
This commit is contained in:
parent
16fd531b6a
commit
2b5e201653
|
@ -13,6 +13,8 @@ import java.util.Map;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.envers.RevisionType;
|
import org.hibernate.envers.RevisionType;
|
||||||
import org.hibernate.envers.boot.internal.EnversService;
|
import org.hibernate.envers.boot.internal.EnversService;
|
||||||
|
import org.hibernate.envers.internal.entities.EntityConfiguration;
|
||||||
|
import org.hibernate.envers.internal.entities.mapper.PropertyMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adam Warski (adam at warski dot org)
|
* @author Adam Warski (adam at warski dot org)
|
||||||
|
@ -45,22 +47,14 @@ public class CollectionChangeWorkUnit extends AbstractAuditWorkUnit implements A
|
||||||
public Map<String, Object> generateData(Object revisionData) {
|
public Map<String, Object> generateData(Object revisionData) {
|
||||||
fillDataWithId( data, revisionData );
|
fillDataWithId( data, revisionData );
|
||||||
final Map<String, Object> preGenerateData = new HashMap<>( data );
|
final Map<String, Object> preGenerateData = new HashMap<>( data );
|
||||||
enversService.getEntitiesConfigurations().get( getEntityName() ).getPropertyMapper().mapToMapFromEntity(
|
|
||||||
sessionImplementor,
|
final EntityConfiguration entityConfig = enversService.getEntitiesConfigurations().get( getEntityName() );
|
||||||
data,
|
final PropertyMapper propertyMapper = entityConfig.getPropertyMapper();
|
||||||
entity,
|
// HHH-7681 - Use entity as 'oldObj' so fake bidirectional non-insertable fields are tracked properly.
|
||||||
null
|
propertyMapper.mapToMapFromEntity( sessionImplementor, data, entity, entity );
|
||||||
);
|
propertyMapper.mapModifiedFlagsToMapFromEntity( sessionImplementor, data, entity, entity );
|
||||||
enversService.getEntitiesConfigurations().get( getEntityName() ).getPropertyMapper().mapModifiedFlagsToMapFromEntity(
|
propertyMapper.mapModifiedFlagsToMapForCollectionChange( collectionPropertyName, data );
|
||||||
sessionImplementor,
|
|
||||||
data,
|
|
||||||
entity,
|
|
||||||
entity
|
|
||||||
);
|
|
||||||
enversService.getEntitiesConfigurations().get( getEntityName() ).getPropertyMapper().mapModifiedFlagsToMapForCollectionChange(
|
|
||||||
collectionPropertyName,
|
|
||||||
data
|
|
||||||
);
|
|
||||||
data.putAll( preGenerateData );
|
data.putAll( preGenerateData );
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue