Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-10799

Add support for discovering JPA 2.1 @Converter during scanning

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 3.2.3
    • Fix Version/s: 4.0 M3
    • Component/s: Data:ORM
    • Labels:

      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)};
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                sinuhe Sinuhé
                Last updater:
                Spring Issuemaster
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  46 weeks, 5 days ago