Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Feb 3, 2016 · 1 comment
Assignees
Labels
in: mapping type: enhancement

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Feb 3, 2016

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

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Mar 9, 2016

Christoph Strobl commented

Hopper M1 still has a Spring 4.1 baseline that does not support @AliasFor.
From a documentation point of view the javadoc of AnnotationUtils is pretty clear about how it does things.
I turned this one into an Improvement. we're looking into it using Spring 4.2 AnnotatedElementUtils.findMergedAnnotation in the commons module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: mapping type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants