Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow type converters to be defined at class-level to allow override of superclass field converters #483

Open
andyjefferson opened this issue Jan 22, 2023 · 1 comment

Comments

@andyjefferson
Copy link
Member

With a JPA @convert we can then do

public class BaseClass
{
    @Convert(converter=MyConv1.class)
    MyType myField;
}
@Convert(attributeName="myField", converter=MyConv2.class)
public class SubClass
{
    ...
}

This will mean that when checking if a field has a converter we need to go via the ClassMetaData, which will find out for the member, firstly checking for class-level overrides, then member specifications.

@clr-apache
Copy link

I believe that the member (field/property) annotation should override the type (class) default specification. So by default, if a member is of a type that is defined as having a converter and has no annotation, the member uses that converter. But a member could still override that default by explicitly naming a different converter via an annotation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants