Change built-in SqlTypeDescriptor impls to not auto-register themselves with SqlTypeDescriptorRegistry

Description

The scope of where this causes issues is extremely limited. It happens in our testsuite but only in CI environment (because tests run in different order there). From my email to the hibernate-dev list:

The issue is with fact that we register org.hibernate.type.descriptor.sql.SqlTypeDescriptor instances with a org.hibernate.type.descriptor.sql.SqlTypeDescriptorRegistry that is unfortunately for now defined statically via a static INSTANCE variable. Our SqlTypeDescriptor implementations register themselves with the registry on creation.

<backstory>
This is all code I added for implementing AttributeConverter support. When we see an AttributeConverter we use the defined "database type" to perform a resolution from the defined type to the recommended JDBC style code for that type, and we then ask the SqlTypeDescriptorRegistry for the SqlTypeDescriptor corresponding to that JDBC type code.
</backstory>

There is a test that subclasses our internal VarcharTypeDescriptor. VarcharTypeDescriptor, like all the SqlTypeDescriptor impls, registers itself with the SqlTypeDescriptorRegistry during its instantiation. The "issue" here is that this subclass also registers itself into the SqlTypeDescriptorRegistry during its instantiation via the call to the super ctor. And because the SqlTypeDescriptorRegistry is static, this causes the "bleeding".

Environment

None

Status

Assignee

Steve Ebersole

Reporter

Steve Ebersole

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure