@@ -46,7 +46,6 @@ public class BasicTypeRegistry implements Serializable {
4646
4747 private final TypeConfiguration typeConfiguration ;
4848
49- private final Map <JdbcType , Map <JavaType <?>, BasicType <?>>> registryValues = new ConcurrentHashMap <>();
5049 private boolean primed ;
5150
5251 private final Map <String , BasicType <?>> typesByName = new ConcurrentHashMap <>();
@@ -94,7 +93,6 @@ private <T> BasicType<T> createBasicType(String name, BasicTypeReference<T> type
9493 final var javaType = getJavaTypeRegistry ().resolveDescriptor ( typeReference .getJavaType () );
9594 final var jdbcType = getJdbcTypeRegistry ().getDescriptor ( typeReference .getSqlTypeCode () );
9695 final var createdType = createBasicType ( typeReference , javaType , jdbcType );
97- primeRegistryEntry ( createdType );
9896 typesByName .put ( typeReference .getName (), createdType );
9997 typesByName .put ( name , createdType );
10098 return createdType ;
@@ -245,11 +243,7 @@ public <J> BasicType<J> resolve(JavaType<J> javaType, JdbcType jdbcType, String
245243 * JdbcType combo or create (and register) one.
246244 */
247245 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 );
253247 }
254248
255249 private <J > BasicType <J > createIfUnregistered (
@@ -277,7 +271,6 @@ private static <J> boolean registeredTypeMatches(JavaType<J> javaType, JdbcType
277271
278272 private <J > void register (JavaType <J > javaType , JdbcType jdbcType , BasicType <J > createdType ) {
279273 if ( createdType != null ) {
280- registryForJdbcType ( jdbcType ).put ( javaType , createdType );
281274 // if we are still building mappings, register this adhoc
282275 // type via a unique code. (This is to support Envers.)
283276 try {
@@ -313,8 +306,6 @@ public void register(BasicType<?> type, String... keys) {
313306 throw new HibernateException ( "Type to register cannot be null" );
314307 }
315308
316- applyOrOverwriteEntry ( type );
317-
318309 // explicit registration keys
319310 if ( isEmpty ( keys ) ) {
320311 LOG .typeDefinedNoRegistrationKeys ( type );
@@ -324,19 +315,6 @@ public void register(BasicType<?> type, String... keys) {
324315 }
325316 }
326317
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-
340318 public <T > CustomType <T > register (UserType <T > type , String ... keys ) {
341319 final var customType = new CustomType <>( type , keys , typeConfiguration );
342320 register ( customType );
@@ -381,8 +359,6 @@ public void addPrimeEntry(BasicType<?> type, String legacyTypeClassName, String[
381359 throw new HibernateException ( "Type to register cannot be null" );
382360 }
383361
384- primeRegistryEntry ( type );
385-
386362 // Legacy name registration
387363 if ( isNotEmpty ( legacyTypeClassName ) ) {
388364 typesByName .put ( legacyTypeClassName , type );
@@ -420,26 +396,6 @@ public void addPrimeEntry(BasicTypeReference<?> type, String legacyTypeClassName
420396 }
421397 }
422398
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-
443399 private void applyRegistrationKeys (BasicType <?> type , String [] keys ) {
444400 for ( String key : keys ) {
445401 if ( key != null ) {
0 commit comments