[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5475) allow for a usertype delegate for org.hibernate.type.EnumType

Jürgen (JIRA) noreply at atlassian.com
Thu Aug 12 20:27:41 EDT 2010


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

                 Key: HHH-5475
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5475
             Project: Hibernate Core
          Issue Type: New Feature
          Components: annotations, core
    Affects Versions: 3.5.4, 3.3.1
            Reporter: Jürgen
         Attachments: EnumType.java

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)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list