diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/NationalizedTypeMappings.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/NationalizedTypeMappings.java index eedea2e257..e3000bae8f 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/NationalizedTypeMappings.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/sql/NationalizedTypeMappings.java @@ -9,10 +9,6 @@ package org.hibernate.type.descriptor.sql; import java.sql.Types; import java.util.Map; -import org.hibernate.internal.util.collections.BoundedConcurrentHashMap; - -import org.jboss.logging.Logger; - /** * Manages a mapping between nationalized and non-nationalized variants of JDBC types. * @@ -22,33 +18,23 @@ import org.jboss.logging.Logger; * @author Steve Ebersole */ public class NationalizedTypeMappings { - private static final Logger log = Logger.getLogger( NationalizedTypeMappings.class ); /** * Singleton access */ public static final NationalizedTypeMappings INSTANCE = new NationalizedTypeMappings(); - private final Map nationalizedCodeByNonNationalized; - - public NationalizedTypeMappings() { - this.nationalizedCodeByNonNationalized = new BoundedConcurrentHashMap(); - map( Types.CHAR, Types.NCHAR ); - map( Types.CLOB, Types.NCLOB ); - map( Types.LONGVARCHAR, Types.LONGNVARCHAR ); - map( Types.VARCHAR, Types.NVARCHAR ); - } - - private void map(int nonNationalizedCode, int nationalizedCode) { - nationalizedCodeByNonNationalized.put( nonNationalizedCode, nationalizedCode ); + private NationalizedTypeMappings() { } public int getCorrespondingNationalizedCode(int jdbcCode) { - Integer nationalizedCode = nationalizedCodeByNonNationalized.get( jdbcCode ); - if ( nationalizedCode == null ) { - log.debug( "Unable to locate nationalized jdbc-code equivalent for given jdbc code : " + jdbcCode ); - return jdbcCode; + switch ( jdbcCode ) { + case Types.CHAR: return Types.NCHAR; + case Types.CLOB: return Types.NCLOB; + case Types.LONGVARCHAR: return Types.LONGNVARCHAR; + case Types.VARCHAR: return Types.NVARCHAR; + default: + throw new IllegalArgumentException( "Unable to locate nationalized jdbc-code equivalent for given jdbc code : " + jdbcCode ); } - return nationalizedCode; } }