Error with access="none" mapping

Description

Mapping a column in a class twice gives an error when building the envers configuration in ClassesAuditingData.UpdateCalculatedFields().

if (propertyAuditingData.ForceInsertable)
{
var referencedEntityName = MappingTools.ReferencedEntityName(pc.GetProperty(propertyName).Value);

// referencedEntityName is null with propertyName = ParentId -> exception when accessing the dictionary

var referencedClassAuditingData = entityNameToAuditingData[referencedEntityName];

forcePropertyInsertable(referencedClassAuditingData, propertyAuditingData.MappedBy,
pc.EntityName, referencedEntityName);

To reproduce:
Add the following to the Unit Test Object OneToMany/CollectionRefIngEntity.cs:

[Audited]
public virtual int? ReferenceId
{
get
{
if (Reference == null) return null;
return Reference.Id;
}
}

Update the Mapping.hbm.xml file for this class to:

<class name="CollectionRefIngEntity">
<id name="Id">
<generator class="assigned"/>
</id>
<property name="Data"/>
<property name="ReferenceId" column ="Reference" access="none" insert="0" update="0"/>
<many-to-one name="Reference" column ="Reference"
class="CollectionRefEdEntity" />
</class>

Environment

DB doesn't matter, it fails when creating the configuration

Assignee

Roger

Reporter

Peter Schojer

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure