[SPR-10799] Add support for discovering JPA 2.1 @Converter during scanning Created: 31/Jul/13  Updated: 15/Jan/19  Resolved: 02/Aug/13

Status: Closed
Project: Spring Framework
Component/s: Data:ORM
Affects Version/s: 3.2.3
Fix Version/s: 4.0 M3

Type: Improvement Priority: Major
Reporter: Sinuhé Assignee: Juergen Hoeller
Resolution: Complete Votes: 0
Labels: jpa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relate
is related to SPR-12234 LocalSessionFactoryBean doesn't suppo... Closed
Reference URL: http://eclipse.1072660.n5.nabble.com/Converter-not-being-picked-up-despite-having-autoApply-true-td161166.html
Days since last comment: 1 year, 30 weeks, 3 days ago
Last commented by a User: true
Last updater: Spring Issuemaster

 Description   

JPA 2.1 spec permits registering of converters using @Converter annotation. This works ok, at least in EclipseLink's last version. But it doesn't work with XML-free configuration using Spring. This is due to DefaultPersistenceUnitManager class, which scans specified packages looking for classes annotated with @Entity, @Embeddable and @MappedSuperclass, but not @Converter.

Just adding new AnnotationTypeFilter(Converter.class, false) to entityTypeFilters field worked for me.

private static final TypeFilter[] entityTypeFilters = new TypeFilter[] {
    new AnnotationTypeFilter(Entity.class, false),
    new AnnotationTypeFilter(Embeddable.class, false),
    new AnnotationTypeFilter(MappedSuperclass.class, false),
    new AnnotationTypeFilter(Converter.class, false)};


 Comments   
Comment by Spring Issuemaster [ 14/Jan/19 ]

The Spring Framework has migrated to GitHub Issues. This issue corresponds to spring-projects/spring-framework#15425.

Generated at Fri Aug 14 15:19:13 UTC 2020 using Jira 8.5.4#805004-sha1:0444eab799707f9ad7b248d69f858774aadfd250.