Skip to content

Commit

Permalink
[ODS-6482] Eliminate unnecessary database roundtrip for ChangeVersion…
Browse files Browse the repository at this point in the history
… after all upserts (#1142)
  • Loading branch information
gmcelhanon authored Sep 25, 2024
1 parent 9dded13 commit c3324e0
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ public void Execute(object sender, BindMappingEventArgs e)

// Maps the ChangeVersion column dynamically
// Requires there be a property on the base entity already
// nHibernate wraps property getter exception in PropertyAccessException if any
// NHibernate wraps property getter exception in PropertyAccessException if any
// underlying mapped properties are set to access "none", due to an invoke exception being triggered.
// generated = "always" to avoid nHibernate trying to set values for it
// <property name="ChangeVersion" column="ChangeVersion" type="long" not-null="true" generated="always" />
// insert = false to never include it in an INSERT statement
// update = false to never include it in an UPDATE statement
// <property name="ChangeVersion" column="ChangeVersion" type="long" not-null="true" generated="never" insert="false" update="false" />
var changeVersionProperty = new HbmProperty
{
name = ChangeQueriesDatabaseConstants.ChangeVersionColumnName,
Expand All @@ -47,7 +48,11 @@ public void Execute(object sender, BindMappingEventArgs e)
name = "long"
},
notnull = true,
generated = HbmPropertyGeneration.Always
generated = HbmPropertyGeneration.Never,
insert = false,
insertSpecified = true,
update = false,
updateSpecified = true,
};
classMapping.Items = classMapping.Items.Concat(changeVersionProperty).ToArray();
}
Expand Down

0 comments on commit c3324e0

Please sign in to comment.