// for the related entity is generated.
final String[] propertyNames = entityPersister.getPropertyNames();
for ( int i = 0; i < propertyNames.length; i++ ) {
final String propertyName = propertyNames[i];
final RelationDescription relDesc = enversConfiguration.getEntCfg().getRelationDescription(
entityName,
propertyName
);
if ( relDesc != null && relDesc.isBidirectional() && relDesc.getRelationType() == RelationType.TO_ONE &&
relDesc.isInsertable() ) {
// Checking for changes
final Object oldValue = oldState == null ? null : oldState[i];
final Object newValue = newState == null ? null : newState[i];
if ( !EntityTools.entitiesEqual( session, relDesc.getToEntityName(), oldValue, newValue ) ) {
// We have to generate changes both in the old collection (size decreses) and new collection
// (size increases).
if ( newValue != null ) {
addCollectionChangeWorkUnit( auditProcess, session, entityName, relDesc, newValue );
}