By using BindingReflectionHintsRegistrar typical data binding use cases for eg. JPA would be covered.
The current registrar implementation would still miss class references in annotation attributes like in @jakarta.persistence.EntityListeners(MyEntityListener.class) but this could be handled processor.
Comment From: sdeleuze
You can find a draft commit on https://github.com/sdeleuze/spring-framework/commit/gh-29096. It uses as expected BindingReflectionHintsRegistrar to register entities reflection hints.
The part which is more tricky is to decide what Class<?> annotation attributes we support since they will require additional hints. At least for now, I have decided to only support JPA annotations, not implementation specific (like Hibernate) ones.
If I am not mistaken, @ManyToMany, @ManyToOne, @OneToMany and @OneToOne are referencing other entities no need for additional hints there.
It is unclear if @MapKeyClass and ElementCollection will require hints, so I think I prefer to now add it for now.
@Converter can be autoapplied without @Convert via @Converter(autoApply=true) so they should probably added via a dedicated mechanism via the @Converter entry point, not the @Convert one which is optional.
So for now in my draft commit I have added support for @IdClass and @EntityListeners which looks to me a reasonable starting point, with the plan to add more support on popular enough features raised by users or our own tests.
@snicoll @christophstrobl @schauder Please let me know if this is ok from your POV or if this should be refined.
Comment From: sdeleuze
I just checked that @Converter classes are properly scanned by PersistenceManagedTypesScanner and they were supported in Spring Native so I will likely add similar support via this issue. Please let me know if you see other points to refine.
Comment From: sdeleuze
@christophstrobl I have added support for @Converter in https://github.com/sdeleuze/spring-framework/commit/gh-29096.
Comment From: christophstrobl
@sdeleuze LGTM. @schauder thoughts?