@@ -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 <>();
@@ -95,7 +94,6 @@ private BasicType<?> createBasicType(String name, BasicTypeReference<?> typeRefe
9594 final var javaType = getJavaTypeRegistry ().getDescriptor ( typeReference .getJavaType () );
9695 final var jdbcType = getJdbcTypeRegistry ().getDescriptor ( typeReference .getSqlTypeCode () );
9796 final var createdType = createBasicType ( typeReference , javaType , jdbcType );
98- primeRegistryEntry ( createdType );
9997 typesByName .put ( typeReference .getName (), createdType );
10098 typesByName .put ( name , createdType );
10199 return createdType ;
@@ -244,11 +242,7 @@ public <J> BasicType<J> resolve(JavaType<J> javaType, JdbcType jdbcType, String
244242 * JdbcType combo or create (and register) one.
245243 */
246244 public <J > BasicType <J > resolve (JavaType <J > javaType , JdbcType jdbcType , Supplier <BasicType <J >> creator ) {
247- final var registeredBasicType = registryForJdbcType ( jdbcType ).get ( javaType );
248- //noinspection unchecked
249- return registeredBasicType != null
250- ? (BasicType <J >) registeredBasicType
251- : createIfUnregistered ( javaType , jdbcType , creator );
245+ return createIfUnregistered ( javaType , jdbcType , creator );
252246 }
253247
254248 private <J > BasicType <J > createIfUnregistered (
@@ -276,7 +270,6 @@ private static <J> boolean registeredTypeMatches(JavaType<J> javaType, JdbcType
276270
277271 private <J > void register (JavaType <J > javaType , JdbcType jdbcType , BasicType <J > createdType ) {
278272 if ( createdType != null ) {
279- registryForJdbcType ( jdbcType ).put ( javaType , createdType );
280273 // if we are still building mappings, register this adhoc
281274 // type via a unique code. (This is to support Envers.)
282275 try {
@@ -312,8 +305,6 @@ public void register(BasicType<?> type, String... keys) {
312305 throw new HibernateException ( "Type to register cannot be null" );
313306 }
314307
315- applyOrOverwriteEntry ( type );
316-
317308 // explicit registration keys
318309 if ( isEmpty ( keys ) ) {
319310 LOG .typeDefinedNoRegistrationKeys ( type );
@@ -323,19 +314,6 @@ public void register(BasicType<?> type, String... keys) {
323314 }
324315 }
325316
326- private void applyOrOverwriteEntry (BasicType <?> type ) {
327- final var jdbcType = type .getJdbcType ();
328- final var existing = registryForJdbcType ( jdbcType ).put ( type .getMappedJavaType (), type );
329- if ( existing != null ) {
330- LOG .tracef (
331- "BasicTypeRegistry registration overwritten (%s + %s); previous =`%s`" ,
332- jdbcType .getFriendlyName (),
333- type .getJavaTypeDescriptor (),
334- existing
335- );
336- }
337- }
338-
339317 public <T > CustomType <T > register (UserType <T > type , String ... keys ) {
340318 final var customType = new CustomType <>( type , keys , typeConfiguration );
341319 register ( customType );
@@ -380,8 +358,6 @@ public void addPrimeEntry(BasicType<?> type, String legacyTypeClassName, String[
380358 throw new HibernateException ( "Type to register cannot be null" );
381359 }
382360
383- primeRegistryEntry ( type );
384-
385361 // Legacy name registration
386362 if ( isNotEmpty ( legacyTypeClassName ) ) {
387363 typesByName .put ( legacyTypeClassName , type );
@@ -419,26 +395,6 @@ public void addPrimeEntry(BasicTypeReference<?> type, String legacyTypeClassName
419395 }
420396 }
421397
422- private void primeRegistryEntry (BasicType <?> type ) {
423- final var jdbcType = type .getJdbcType ();
424- final var existing = registryForJdbcType ( jdbcType ).get ( type .getMappedJavaType () );
425- if ( existing != null ) {
426- LOG .tracef (
427- "Skipping registration of BasicType (%s + %s); still priming. existing = %s" ,
428- jdbcType .getFriendlyName (),
429- type .getJavaTypeDescriptor (),
430- existing
431- );
432- }
433- else {
434- registryForJdbcType ( jdbcType ).put ( type .getMappedJavaType (), type );
435- }
436- }
437-
438- private Map <JavaType <?>, BasicType <?>> registryForJdbcType (JdbcType jdbcType ) {
439- return registryValues .computeIfAbsent ( jdbcType , key -> new ConcurrentHashMap <>() );
440- }
441-
442398 private void applyRegistrationKeys (BasicType <?> type , String [] keys ) {
443399 for ( String key : keys ) {
444400 if ( key != null ) {
0 commit comments