|
28 | 28 | */ |
29 | 29 | public class VersionResolution<E> implements BasicValue.Resolution<E> { |
30 | 30 |
|
31 | | - // todo (6.0) : support explicit JTD? |
32 | | - // todo (6.0) : support explicit STD? |
33 | | - |
34 | | - public static <E> VersionResolution<E> from( |
| 31 | + public static VersionResolution<?> from( |
35 | 32 | Function<TypeConfiguration, java.lang.reflect.Type> implicitJavaTypeAccess, |
36 | 33 | TimeZoneStorageType timeZoneStorageType, |
37 | 34 | MetadataBuildingContext context) { |
38 | | - |
39 | | - // todo (6.0) : add support for Dialect-specific interpretation? |
40 | | - |
41 | 35 | final var typeConfiguration = context.getBootstrapContext().getTypeConfiguration(); |
42 | 36 | final var implicitJavaType = implicitJavaTypeAccess.apply( typeConfiguration ); |
43 | | - final JavaType<E> registered = typeConfiguration.getJavaTypeRegistry().getDescriptor( implicitJavaType ); |
44 | | - final var basicJavaType = (BasicJavaType<E>) registered; |
| 37 | + final var registered = typeConfiguration.getJavaTypeRegistry().resolveDescriptor( implicitJavaType ); |
| 38 | + return resolve( timeZoneStorageType, context, (BasicJavaType<?>) registered ); |
| 39 | + } |
45 | 40 |
|
| 41 | + private static <E> VersionResolution<E> resolve( |
| 42 | + TimeZoneStorageType timeZoneStorageType, |
| 43 | + MetadataBuildingContext context, |
| 44 | + BasicJavaType<E> basicJavaType) { |
| 45 | + final var typeConfiguration = context.getBootstrapContext().getTypeConfiguration(); |
46 | 46 | final var recommendedJdbcType = basicJavaType.getRecommendedJdbcType( |
47 | 47 | new JdbcTypeIndicators() { |
48 | 48 | @Override |
49 | 49 | public TypeConfiguration getTypeConfiguration() { |
50 | 50 | return typeConfiguration; |
51 | 51 | } |
52 | 52 |
|
53 | | - @Override |
| 53 | + @Override @SuppressWarnings("deprecation") |
54 | 54 | public TemporalType getTemporalPrecision() { |
55 | 55 | // if it is a temporal version, it needs to be a TIMESTAMP |
56 | 56 | return TemporalType.TIMESTAMP; |
@@ -106,7 +106,6 @@ public Dialect getDialect() { |
106 | 106 | final var basicTypeRegistry = typeConfiguration.getBasicTypeRegistry(); |
107 | 107 | final var basicType = basicTypeRegistry.resolve( basicJavaType, recommendedJdbcType ); |
108 | 108 | final var legacyType = basicTypeRegistry.getRegisteredType( basicJavaType.getJavaTypeClass() ); |
109 | | - |
110 | 109 | assert legacyType.getJdbcType().getDefaultSqlTypeCode() == recommendedJdbcType.getDefaultSqlTypeCode(); |
111 | 110 |
|
112 | 111 | return new VersionResolution<>( basicJavaType, recommendedJdbcType, basicType, legacyType ); |
|
0 commit comments