Uploaded image for project: 'Spring Data MongoDB'
  1. Spring Data MongoDB
  2. DATAMONGO-1373

Problem with custom annotations with AliasFor annotated attributes

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9 M1 (Hopper)
    • Fix Version/s: 1.9 RC1 (Hopper)
    • Component/s: Mapping / Conversion
    • Labels:
      None

      Description

      Cause 1.9 relies on AnnotationUtils, it should provide full support for custom annotations and should support Springs 4.2 AliasFor annotations.

      Consider a custom annotation metaannotated with @Document annotation.
      Let it have a collection attribute, alias for @Document collection attribute.
      Let it not be marked as @Inherited.

      Let a pair of entities, a parent and a child. Let the parent be annotated with the custom annotation, and set a given value for its collection atribute.

      You would expect both entities, when made PersistentEntities, have the same collection name provided in the collection attribute.

      Actual result is that both of them get the fallback collection name and not the collection name provided.

      I thought it could caused because of @Document being @Inherited.
      How does @Inhereted affect AnnotationUtils search algortihm?
      Once you go through AnnotationUtils, could @Document annotated with @Inherited be considered residual? See BasicMongoPersistentEntity

      Anyway, i tried removing @Inherited annotation and same result.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              cstrobl Christoph Strobl
              Reporter:
              omaralles omar alles
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: