77import java .lang .reflect .Type ;
88import java .util .List ;
99
10- import org .hibernate .dialect .Dialect ;
1110import org .hibernate .engine .jdbc .Size ;
12- import org .hibernate .internal .build .AllowReflection ;
1311import org .hibernate .metamodel .mapping .JdbcMappingContainer ;
1412import org .hibernate .metamodel .mapping .SqlTypedMapping ;
1513import org .hibernate .metamodel .model .domain .DomainType ;
1614import org .hibernate .metamodel .model .domain .ReturnableType ;
1715import org .hibernate .sql .ast .spi .AbstractSqlAstTranslator ;
1816import org .hibernate .type .BasicType ;
1917import org .hibernate .type .descriptor .java .BasicPluralJavaType ;
20- import org .hibernate .type .descriptor .sql .DdlType ;
21- import org .hibernate .type .descriptor .sql .spi .DdlTypeRegistry ;
2218import org .hibernate .type .internal .ParameterizedTypeImpl ;
2319import org .hibernate .type .spi .TypeConfiguration ;
2420
2521public class DdlTypeHelper {
2622 @ SuppressWarnings ("unchecked" )
27- @ AllowReflection
23+ // @AllowReflection
2824 public static BasicType <?> resolveArrayType (DomainType <?> elementType , TypeConfiguration typeConfiguration ) {
29- @ SuppressWarnings ("unchecked" )
3025 final var arrayJavaType =
3126 (BasicPluralJavaType <Object >)
3227 typeConfiguration .getJavaTypeRegistry ()
3328 .resolveArrayDescriptor ( elementType .getJavaType () );
34- final Dialect dialect = typeConfiguration .getCurrentBaseSqlTypeIndicators ().getDialect ();
3529 return arrayJavaType .resolveType (
3630 typeConfiguration ,
37- dialect ,
31+ typeConfiguration . getCurrentBaseSqlTypeIndicators (). getDialect () ,
3832 (BasicType <Object >) elementType ,
3933 null ,
4034 typeConfiguration .getCurrentBaseSqlTypeIndicators ()
@@ -43,7 +37,6 @@ public static BasicType<?> resolveArrayType(DomainType<?> elementType, TypeConfi
4337
4438 @ SuppressWarnings ("unchecked" )
4539 public static BasicType <?> resolveListType (DomainType <?> elementType , TypeConfiguration typeConfiguration ) {
46- @ SuppressWarnings ("unchecked" )
4740 final BasicPluralJavaType <Object > arrayJavaType =
4841 (BasicPluralJavaType <Object >)
4942 typeConfiguration .getJavaTypeRegistry ()
@@ -52,10 +45,9 @@ public static BasicType<?> resolveListType(DomainType<?> elementType, TypeConfig
5245 new ParameterizedTypeImpl ( List .class , new Type []{ elementType .getJavaType () }, null ),
5346 typeConfiguration
5447 );
55- final Dialect dialect = typeConfiguration .getCurrentBaseSqlTypeIndicators ().getDialect ();
5648 return arrayJavaType .resolveType (
5749 typeConfiguration ,
58- dialect ,
50+ typeConfiguration . getCurrentBaseSqlTypeIndicators (). getDialect () ,
5951 (BasicType <Object >) elementType ,
6052 null ,
6153 typeConfiguration .getCurrentBaseSqlTypeIndicators ()
@@ -79,11 +71,9 @@ public static String getTypeName(JdbcMappingContainer type, Size size, TypeConfi
7971 return AbstractSqlAstTranslator .getSqlTypeName ( sqlTypedMapping , typeConfiguration );
8072 }
8173 else {
82- final BasicType <?> basicType = (BasicType <?>) type .getSingleJdbcMapping ();
83- final DdlTypeRegistry ddlTypeRegistry = typeConfiguration .getDdlTypeRegistry ();
84- final DdlType ddlType = ddlTypeRegistry .getDescriptor (
85- basicType .getJdbcType ().getDdlTypeCode ()
86- );
74+ final var basicType = (BasicType <?>) type .getSingleJdbcMapping ();
75+ final var ddlTypeRegistry = typeConfiguration .getDdlTypeRegistry ();
76+ final var ddlType = ddlTypeRegistry .getDescriptor ( basicType .getJdbcType ().getDdlTypeCode () );
8777 return ddlType .getTypeName ( size , basicType , ddlTypeRegistry );
8878 }
8979 }
@@ -97,11 +87,9 @@ public static String getTypeName(ReturnableType<?> type, Size size, TypeConfigur
9787 return AbstractSqlAstTranslator .getSqlTypeName ( sqlTypedMapping , typeConfiguration );
9888 }
9989 else {
100- final BasicType <?> basicType = (BasicType <?>) ( (JdbcMappingContainer ) type ).getSingleJdbcMapping ();
101- final DdlTypeRegistry ddlTypeRegistry = typeConfiguration .getDdlTypeRegistry ();
102- final DdlType ddlType = ddlTypeRegistry .getDescriptor (
103- basicType .getJdbcType ().getDdlTypeCode ()
104- );
90+ final var basicType = (BasicType <?>) ( (JdbcMappingContainer ) type ).getSingleJdbcMapping ();
91+ final var ddlTypeRegistry = typeConfiguration .getDdlTypeRegistry ();
92+ final var ddlType = ddlTypeRegistry .getDescriptor ( basicType .getJdbcType ().getDdlTypeCode () );
10593 return ddlType .getTypeName ( size , basicType , ddlTypeRegistry );
10694 }
10795 }
@@ -123,11 +111,9 @@ public static String getCastTypeName(JdbcMappingContainer type, Size size, TypeC
123111 return AbstractSqlAstTranslator .getCastTypeName ( sqlTypedMapping , typeConfiguration );
124112 }
125113 else {
126- final BasicType <?> basicType = (BasicType <?>) type .getSingleJdbcMapping ();
127- final DdlTypeRegistry ddlTypeRegistry = typeConfiguration .getDdlTypeRegistry ();
128- final DdlType ddlType = ddlTypeRegistry .getDescriptor (
129- basicType .getJdbcType ().getDdlTypeCode ()
130- );
114+ final var basicType = (BasicType <?>) type .getSingleJdbcMapping ();
115+ final var ddlTypeRegistry = typeConfiguration .getDdlTypeRegistry ();
116+ final var ddlType = ddlTypeRegistry .getDescriptor ( basicType .getJdbcType ().getDdlTypeCode () );
131117 return ddlType .getCastTypeName ( size , basicType , ddlTypeRegistry );
132118 }
133119 }
@@ -141,11 +127,9 @@ public static String getCastTypeName(ReturnableType<?> type, Size size, TypeConf
141127 return AbstractSqlAstTranslator .getCastTypeName ( sqlTypedMapping , typeConfiguration );
142128 }
143129 else {
144- final BasicType <?> basicType = (BasicType <?>) ( (JdbcMappingContainer ) type ).getSingleJdbcMapping ();
145- final DdlTypeRegistry ddlTypeRegistry = typeConfiguration .getDdlTypeRegistry ();
146- final DdlType ddlType = ddlTypeRegistry .getDescriptor (
147- basicType .getJdbcType ().getDdlTypeCode ()
148- );
130+ final var basicType = (BasicType <?>) ( (JdbcMappingContainer ) type ).getSingleJdbcMapping ();
131+ final var ddlTypeRegistry = typeConfiguration .getDdlTypeRegistry ();
132+ final var ddlType = ddlTypeRegistry .getDescriptor ( basicType .getJdbcType ().getDdlTypeCode () );
149133 return ddlType .getCastTypeName ( size , basicType , ddlTypeRegistry );
150134 }
151135 }
0 commit comments