From c3324e01dcb16bd9d0e92e8b4a288c119d4dedd8 Mon Sep 17 00:00:00 2001 From: Geoff McElhanon Date: Wed, 25 Sep 2024 14:36:03 -0500 Subject: [PATCH] [ODS-6482] Eliminate unnecessary database roundtrip for ChangeVersion after all upserts (#1142) --- ...nFilterMappingNHibernateConfigurationActivity.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Application/EdFi.Ods.Features/ChangeQueries/ChangeVersionFilterMappingNHibernateConfigurationActivity.cs b/Application/EdFi.Ods.Features/ChangeQueries/ChangeVersionFilterMappingNHibernateConfigurationActivity.cs index 9fed3e0137..d8a8ea0b51 100644 --- a/Application/EdFi.Ods.Features/ChangeQueries/ChangeVersionFilterMappingNHibernateConfigurationActivity.cs +++ b/Application/EdFi.Ods.Features/ChangeQueries/ChangeVersionFilterMappingNHibernateConfigurationActivity.cs @@ -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 - // + // insert = false to never include it in an INSERT statement + // update = false to never include it in an UPDATE statement + // var changeVersionProperty = new HbmProperty { name = ChangeQueriesDatabaseConstants.ChangeVersionColumnName, @@ -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(); }