diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/DatabaseIdentifier.java b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/DatabaseIdentifier.java index 6f60bb8fb0..88e70f0faf 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/DatabaseIdentifier.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/DatabaseIdentifier.java @@ -14,19 +14,26 @@ import org.hibernate.internal.util.StringHelper; * @author Andrea Boriero */ public class DatabaseIdentifier extends Identifier { + protected DatabaseIdentifier(String text) { + super( text ); + } + /** * Constructs a datatabase identifier instance. * * @param text The identifier text. */ - public DatabaseIdentifier(String text) { - super( text, false ); - } - public static DatabaseIdentifier toIdentifier(String text) { if ( StringHelper.isEmpty( text ) ) { return null; } - return new DatabaseIdentifier( text ); + else if ( isQuoted( text ) ) { + // exclude the quotes from text + final String unquotedtext = text.substring( 1, text.length() - 1 ); + return new DatabaseIdentifier( unquotedtext ); + } + else { + return new DatabaseIdentifier( text ); + } } } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/Identifier.java b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/Identifier.java index b63a6fe6ab..fafcd35635 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/Identifier.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/Identifier.java @@ -113,6 +113,16 @@ public class Identifier implements Comparable { this.isQuoted = quoted; } + /** + * Constructs an unquoted identifier instance. + * + * @param text The identifier text. + */ + protected Identifier(String text) { + this.text = text; + this.isQuoted = false; + } + /** * Get the identifiers name (text) *