diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/ImprovedModifiedColumnNamingStrategy.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/ImprovedModifiedColumnNamingStrategy.java index 3fa797cbad..75741c4831 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/ImprovedModifiedColumnNamingStrategy.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/ImprovedModifiedColumnNamingStrategy.java @@ -10,7 +10,6 @@ import org.hibernate.envers.boot.spi.ModifiedColumnNamingStrategy; import org.hibernate.envers.configuration.internal.GlobalConfiguration; import org.hibernate.envers.configuration.internal.metadata.MetadataTools; import org.hibernate.envers.configuration.internal.metadata.reader.PropertyAuditingData; -import org.hibernate.envers.internal.tools.StringTools; import org.hibernate.mapping.Column; import org.hibernate.mapping.Selectable; import org.hibernate.mapping.Value; @@ -30,9 +29,9 @@ import org.dom4j.Element; * * * @author Chris Cranford - * @since 5.4.6 + * @since 5.4.7 */ -public class ImprovedModifiedColumnNamingStrategy implements ModifiedColumnNamingStrategy { +public class ImprovedModifiedColumnNamingStrategy extends LegacyModifiedColumnNamingStrategy { @Override public void addModifiedColumns( GlobalConfiguration globalCfg, @@ -48,7 +47,7 @@ public class ImprovedModifiedColumnNamingStrategy implements ModifiedColumnNamin Selectable selectable = value.getColumnIterator().next(); if ( selectable instanceof Column ) { // This should not be applied for formulas - String columnName = propertyAuditingData.getModifiedFlagName(); + final String columnName; if ( !propertyAuditingData.isModifiedFlagNameExplicitlySpecified() ) { columnName = ( (Column) selectable ).getName() + globalCfg.getModifiedFlagSuffix(); } @@ -70,11 +69,6 @@ public class ImprovedModifiedColumnNamingStrategy implements ModifiedColumnNamin } // Default legacy behavior - MetadataTools.addModifiedFlagProperty( - parent, - propertyAuditingData.getName(), - globalCfg.getModifiedFlagSuffix(), - propertyAuditingData.getModifiedFlagName() - ); + super.addModifiedColumns( globalCfg, value, parent, propertyAuditingData ); } } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/LegacyModifiedColumnNamingStrategy.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/LegacyModifiedColumnNamingStrategy.java index 528aea71e1..3d035330e2 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/LegacyModifiedColumnNamingStrategy.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/LegacyModifiedColumnNamingStrategy.java @@ -24,7 +24,7 @@ import org.dom4j.Element; * This is the default Envers modified column naming behavior. * * @author Chris Cranford - * @since 5.4.6 + * @since 5.4.7 */ public class LegacyModifiedColumnNamingStrategy implements ModifiedColumnNamingStrategy { @Override @@ -33,10 +33,13 @@ public class LegacyModifiedColumnNamingStrategy implements ModifiedColumnNamingS Value value, Element parent, PropertyAuditingData propertyAuditingData) { - String columnName = propertyAuditingData.getModifiedFlagName(); + final String columnName; if ( propertyAuditingData.isModifiedFlagNameExplicitlySpecified() ) { columnName = propertyAuditingData.getExplicitModifiedFlagName(); } + else { + columnName = propertyAuditingData.getModifiedFlagName(); + } MetadataTools.addModifiedFlagProperty( parent, propertyAuditingData.getName(), diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/spi/ModifiedColumnNamingStrategy.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/spi/ModifiedColumnNamingStrategy.java index 9b624affaa..b38f8cc734 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/spi/ModifiedColumnNamingStrategy.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/spi/ModifiedColumnNamingStrategy.java @@ -17,7 +17,7 @@ import org.dom4j.Element; * Defines a naming strategy for applying modified columns to the audited entity metamodel. * * @author Chris Cranford - * @since 5.4.6 + * @since 5.4.7 */ @Incubating public interface ModifiedColumnNamingStrategy { diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/EnversSettings.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/EnversSettings.java index ecda1490d7..b1a079f903 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/EnversSettings.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/EnversSettings.java @@ -139,7 +139,7 @@ public interface EnversSettings { * * Defaults to {@link org.hibernate.envers.boot.internal.LegacyModifiedColumnNamingStrategy}. * - * @since 5.4.6 + * @since 5.4.7 */ String MODIFIED_COLUMN_NAMING_STRATEGY = "org.hibernate.envers.modified_column_naming_strategy"; }