allow for a usertype delegate for org.hibernate.type.EnumType

Description

I use a custom UserType to right-trim CHAR columns in a legacy DB2, which returns CHAR columns right space padded.

Now I would like map such a column to a Enum, which fails using @Enumerated (org.hibernate.type.EnumType) due to the fact that DB column values with right pad spaces do not match enum names.

I would like to request the a EnumType that allows to inject/delegate to a UserType.
(db column + UserType = java object toString()-able or Numeric) + EnumType = Enum

Of course one could always define a UserType doing triming + enum conversion but would be nice to make it pluggable

I added a workaround delegated EnumType that uses some dirty stuff to handle the described process, including reflection and implementing stubs for ResultSet + PreparedStatement (thats why the Class is so huge, the real logic is quite small)

Environment

None

Assignee

Unassigned

Reporter

Jürgen

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major