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
Missing indexes in associations involving generic types [DATAMONGO-1263] #2183
Comments
Oliver Drotbohm commented Have you tried this with a more recent version of Spring Data MongoDB, Fowler SR2 (1.7.2)? We solved a few bugs in the area of generic in the last couple of releases |
Jordi Llach Fernandez commented Yeah, you mean https://jira.spring.io/browse/DATAMONGO-1202 , although the github sample is configured with 1.6.3.RELEASE I've just tried with the recently released Fowler-SR2 and also fails |
Oliver Drotbohm commented Actually I was thinking of DATACMNS-697 as that was the only one that came to my mind directly. Did you upgrade Spring Data Commons to one of the versions mentioned in that ticket, too? Either way, I'll have a look tomorrow morning |
Jordi Llach Fernandez commented Tested with spring data release train Fowler-SR2 which implies spring-data-commons-1.10.2.RELEASE and spring-data-mongodb-1.7.2.RELEASE |
Oliver Drotbohm commented Christoph Strobl - Would you mind having a look? Seems like we're dropping back from |
Christoph Strobl commented There's a glitch in |
Christoph Strobl commented already on github 82850d for 1.7.x and 9da432 for 1.8.x |
Agustí Sánchez opened DATAMONGO-1263 and commented
When an association between documents involves generic types, the type information is not correctly inferred at startup time resulting in missing indexes.
Please, see https://github.com/agustisanchez/SpringDataMongoDBBug, for code samples.
Given:
When defining a class Catalog with a list of "wrapped" books:
The index "name" inherited from AbstractProduct is created (book2.content.name) inside "catalog" , but the index defined on the Book class itself (isbn) is not created as Spring Data Mongo is only inferring type infromation from the ProductWrapper class definition (ProductWrapper <T extends AbstractProduct>).
Spring Data MongoDB should be able to infer type information from the list declaration ( List<ProductWrapper<Book>> ), becoming aware that Catalog contains a list of Books, hence indexes defined on Book should be created.
If the wrapper class is defined as ProductWrapper<T>, then no indexes are created at all on Catalog.books2.content
Affects: 1.6.3 (Evans SR3)
Reference URL: https://github.com/agustisanchez/SpringDataMongoDBBug/
Referenced from: pull request #312
Backported to: 1.7.3 (Fowler SR3)
1 votes, 4 watchers
The text was updated successfully, but these errors were encountered: