We're updating the issue view to help you get more done. 

MetadataBuilderContributor should be applied before MetadataBuildingProcess.prepare

Description

If we have an AttributeConverter:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 @Converter(autoApply = true) public static class YearMonthAttributeConverter implements AttributeConverter<YearMonth, Integer> { @Override public Integer convertToDatabaseColumn(YearMonth attribute) { return (attribute.getYear() * 100) + attribute.getMonth().getValue(); } @Override public YearMonth convertToEntityAttribute(Integer dbData) { return YearMonth.of(dbData / 100, dbData % 100); } }

And we try to configure it via the MetadataBuilderContributor:

1 2 3 4 5 options.put( EntityManagerFactoryBuilderImpl.METADATA_BUILDER_CONTRIBUTOR, (MetadataBuilderContributor) metadataBuilder -> metadataBuilder.applyAttributeConverter( YearMonthAttributeConverter.class ) );

The converter will not be considered because the MetadataBuildingProcess.prepare already collects all the provided AttributeConverter instances prior to registering them via the MetadataBuilderContributor.

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Vlad Mihalcea

Fix versions

Labels

None

backPortable

Backport?

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.3.6

Priority

Major