@@ -46,7 +46,6 @@ public class BasicTypeRegistry implements Serializable {
46
46
47
47
private final TypeConfiguration typeConfiguration ;
48
48
49
- private final Map <JdbcType , Map <JavaType <?>, BasicType <?>>> registryValues = new ConcurrentHashMap <>();
50
49
private boolean primed ;
51
50
52
51
private final Map <String , BasicType <?>> typesByName = new ConcurrentHashMap <>();
@@ -94,7 +93,6 @@ private <T> BasicType<T> createBasicType(String name, BasicTypeReference<T> type
94
93
final var javaType = getJavaTypeRegistry ().resolveDescriptor ( typeReference .getJavaType () );
95
94
final var jdbcType = getJdbcTypeRegistry ().getDescriptor ( typeReference .getSqlTypeCode () );
96
95
final var createdType = createBasicType ( typeReference , javaType , jdbcType );
97
- primeRegistryEntry ( createdType );
98
96
typesByName .put ( typeReference .getName (), createdType );
99
97
typesByName .put ( name , createdType );
100
98
return createdType ;
@@ -245,11 +243,7 @@ public <J> BasicType<J> resolve(JavaType<J> javaType, JdbcType jdbcType, String
245
243
* JdbcType combo or create (and register) one.
246
244
*/
247
245
public <J > BasicType <J > resolve (JavaType <J > javaType , JdbcType jdbcType , Supplier <BasicType <J >> creator ) {
248
- final var registeredBasicType = registryForJdbcType ( jdbcType ).get ( javaType );
249
- //noinspection unchecked
250
- return registeredBasicType != null
251
- ? (BasicType <J >) registeredBasicType
252
- : createIfUnregistered ( javaType , jdbcType , creator );
246
+ return createIfUnregistered ( javaType , jdbcType , creator );
253
247
}
254
248
255
249
private <J > BasicType <J > createIfUnregistered (
@@ -277,7 +271,6 @@ private static <J> boolean registeredTypeMatches(JavaType<J> javaType, JdbcType
277
271
278
272
private <J > void register (JavaType <J > javaType , JdbcType jdbcType , BasicType <J > createdType ) {
279
273
if ( createdType != null ) {
280
- registryForJdbcType ( jdbcType ).put ( javaType , createdType );
281
274
// if we are still building mappings, register this adhoc
282
275
// type via a unique code. (This is to support Envers.)
283
276
try {
@@ -313,8 +306,6 @@ public void register(BasicType<?> type, String... keys) {
313
306
throw new HibernateException ( "Type to register cannot be null" );
314
307
}
315
308
316
- applyOrOverwriteEntry ( type );
317
-
318
309
// explicit registration keys
319
310
if ( isEmpty ( keys ) ) {
320
311
LOG .typeDefinedNoRegistrationKeys ( type );
@@ -324,19 +315,6 @@ public void register(BasicType<?> type, String... keys) {
324
315
}
325
316
}
326
317
327
- private void applyOrOverwriteEntry (BasicType <?> type ) {
328
- final var jdbcType = type .getJdbcType ();
329
- final var existing = registryForJdbcType ( jdbcType ).put ( type .getMappedJavaType (), type );
330
- if ( existing != null ) {
331
- LOG .tracef (
332
- "BasicTypeRegistry registration overwritten (%s + %s); previous =`%s`" ,
333
- jdbcType .getFriendlyName (),
334
- type .getJavaTypeDescriptor (),
335
- existing
336
- );
337
- }
338
- }
339
-
340
318
public <T > CustomType <T > register (UserType <T > type , String ... keys ) {
341
319
final var customType = new CustomType <>( type , keys , typeConfiguration );
342
320
register ( customType );
@@ -381,8 +359,6 @@ public void addPrimeEntry(BasicType<?> type, String legacyTypeClassName, String[
381
359
throw new HibernateException ( "Type to register cannot be null" );
382
360
}
383
361
384
- primeRegistryEntry ( type );
385
-
386
362
// Legacy name registration
387
363
if ( isNotEmpty ( legacyTypeClassName ) ) {
388
364
typesByName .put ( legacyTypeClassName , type );
@@ -420,26 +396,6 @@ public void addPrimeEntry(BasicTypeReference<?> type, String legacyTypeClassName
420
396
}
421
397
}
422
398
423
- private void primeRegistryEntry (BasicType <?> type ) {
424
- final var jdbcType = type .getJdbcType ();
425
- final var existing = registryForJdbcType ( jdbcType ).get ( type .getMappedJavaType () );
426
- if ( existing != null ) {
427
- LOG .tracef (
428
- "Skipping registration of BasicType (%s + %s); still priming. existing = %s" ,
429
- jdbcType .getFriendlyName (),
430
- type .getJavaTypeDescriptor (),
431
- existing
432
- );
433
- }
434
- else {
435
- registryForJdbcType ( jdbcType ).put ( type .getMappedJavaType (), type );
436
- }
437
- }
438
-
439
- private Map <JavaType <?>, BasicType <?>> registryForJdbcType (JdbcType jdbcType ) {
440
- return registryValues .computeIfAbsent ( jdbcType , key -> new ConcurrentHashMap <>() );
441
- }
442
-
443
399
private void applyRegistrationKeys (BasicType <?> type , String [] keys ) {
444
400
for ( String key : keys ) {
445
401
if ( key != null ) {
0 commit comments