Skip to content

Problem with custom annotations with AliasFor annotated attributes [DATAMONGO-1373] #2289

@spring-projects-issues

Description

@spring-projects-issues

omar alles opened DATAMONGO-1373 and commented

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.


Affects: 1.9 M1 (Hopper)

Reference URL: https://github.com/oalles/spring-data-custom-annotation-bug

Issue Links:

  • DATACASS-259 Allow usage of Spring 4.2 @AliasFor for Cassandra annotations

  • DATACMNS-825 Allow usage of composed annotations on PersistentEntity and PersistentProperty using @AliasFor

Referenced from: pull request #347

Metadata

Metadata

Labels

in: mappingMapping and conversion infrastructuretype: enhancementA general enhancement

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions