private static AuditMappedByAttribute createAuditMappedByAttributeIfReferenceImmutable(Mapping.Collection collectionValue, Property referencedProperty) { AuditMappedByAttribute attr = null; //check if bidrectional //TODO: backref check here is wrong! But if it's fixed it will be a big breaking change I guess.. For now, an extra table will be created. if (!referencedProperty.BackRef && isRelation(collectionValue, referencedProperty)) { attr = new AuditMappedByAttribute { MappedBy = referencedProperty.Name }; if (!referencedProperty.IsUpdateable && !referencedProperty.IsInsertable && //check that non update/insert properties are not also part of id! !MappingTools.AnyColumnMatches(referencedProperty.ColumnIterator, referencedProperty.PersistentClass.Identifier.ColumnIterator)) { attr.ForceInsertOverride = true; } } return(attr); }