Uploaded image for project: 'Hibernate ORM'
  1. HHH-11548

Regression: Ambiguous attribute converters as converter for parent type is also asigned

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.2.8
    • Fix Version/s: None
    • Labels:
      None
    • Last commented by a user?:
      true
    • Sprint:

      Description

      I have two custom datatypes: A and B where B extends A.
      Also I do have AAttributeConverter for A and BAttributeConverter for B (both with @Converter(autoApply = true)).
      This scenario works fine with hibernate 5.0.9.Final.
      However, when I update to recent 5.2.8.Final I get this error:

      Caused by: java.lang.RuntimeException: Multiple auto-apply converters matched attribute [com.example.MyBean.value] : com.example.AAttributeConverter, com.example.BAttributeConverter
      	at org.hibernate.boot.internal.AttributeConverterManager.findAutoApplyConverterForAttribute(AttributeConverterManager.java:93)
      	at org.hibernate.cfg.AbstractPropertyHolder.resolveAttributeConverterDescriptor(AbstractPropertyHolder.java:96)
      ...
      

      The property MyBean.value has type B that extends A. As BAttributeConverter is more specific and AAttributeConverter can not actually handle B hibernate should IMHO not consider AAttributeConverter here.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: