diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/ObjectNameNormalizer.java b/hibernate-core/src/main/java/org/hibernate/cfg/ObjectNameNormalizer.java index d374505df2..ef629ccecb 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/ObjectNameNormalizer.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/ObjectNameNormalizer.java @@ -108,6 +108,12 @@ public abstract class ObjectNameNormalizer { return '`' + identifier.substring( 1, identifier.length() - 1 ) + '`'; } + // Convert SQLServer style quoting + // TODO: This really should be tied to Dialect#openQuote/closeQuote + if ( identifier.startsWith( "[" ) && identifier.endsWith( "]" ) ) { + return '`' + identifier.substring( 1, identifier.length() - 1 ) + '`'; + } + // If the user has requested "global" use of quoted identifiers, quote this identifier (using back ticks) // if not already if ( isUseQuotedIdentifiersGlobally() && ! ( identifier.startsWith( "`" ) && identifier.endsWith( "`" ) ) ) {