public SqlTypeDescriptor resolveSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor) {
if ( resolvedSqlTypeDescriptors == null ) {
throw new IllegalStateException( "cannot resolve a SqlTypeDescriptor until the TypeResolver is scoped." );
}
SqlTypeDescriptor resolvedDescriptor = resolvedSqlTypeDescriptors.get( sqlTypeDescriptor );
if ( resolvedDescriptor == null ) {
resolvedDescriptor =
typeFactory.resolveSessionFactory().getDialect().resolveSqlTypeDescriptor( sqlTypeDescriptor );
if ( resolvedDescriptor == null ) {
throw new IllegalStateException( "dialect returned a resolved SqlTypeDescriptor that was null." );
}
if ( sqlTypeDescriptor != resolvedDescriptor ) {
LOG.addingOverrideFor(sqlTypeDescriptor.getClass().getName(), resolvedDescriptor.getClass().getName());
if ( sqlTypeDescriptor.getSqlType() != resolvedDescriptor.getSqlType() ) {
LOG.resolvedSqlTypeDescriptorForDifferentSqlCode(sqlTypeDescriptor.getClass().getName(),
String.valueOf(sqlTypeDescriptor.getSqlType()),
resolvedDescriptor.getClass().getName(),
String.valueOf(resolvedDescriptor.getSqlType()));
}
}
resolvedSqlTypeDescriptors.put( sqlTypeDescriptor, resolvedDescriptor );
}
return resolvedDescriptor;