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

BasicPersistentEntity.addAssociations(…) must not add null values to the collection of associations [DATACMNS-934] #1387

Closed
spring-projects-issues opened this issue Nov 11, 2016 · 1 comment
Assignees
Labels
in: mapping Mapping and conversion infrastructure type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link

David Rodriguez Polo opened DATACMNS-934 and commented

The issue happens when use the same class to define an entity of Spring Data MongoDB and Spring Data Solr, and also have a field with annotation in MongoDB as @DBRef. @DBRef adds the annotation @Reference, when mapping the object to SimpleSolrPersistentEntity, this sets to null the property association on AbstractPersistentProperty. Then, when you make a search with Spring Data Solr and try to get the hasScoreProperty() this throws a NullPointerException.

   at org.springframework.data.mapping.model.BasicPersistentEntity.getPersistentProperty(BasicPersistentEntity.java:266)
at org.springframework.data.solr.core.mapping.SimpleSolrPersistentEntity.getScoreProperty(SimpleSolrPersistentEntity.java:133)
at org.springframework.data.solr.core.mapping.SimpleSolrPersistentEntity.hasScoreProperty(SimpleSolrPersistentEntity.java:124)
at org.springframework.data.solr.core.SolrTemplate.query(SolrTemplate.java:497)
at org.springframework.data.solr.core.SolrTemplate.doQueryForPage(SolrTemplate.java:338)
at org.springframework.data.solr.core.SolrTemplate.queryForPage(SolrTemplate.java:350)
at com.mycompany.engine.solr.repositories.bc.SolrBCDaoImpl.selectObject(SolrBCDaoImpl.java:104)

Affects: 1.13 M1 (Ingalls), 1.11.6 (Gosling SR6), 1.12.5 (Hopper SR5), 2.0 M1 (Kay)

Issue Links:

  • DATASOLR-341 SolrBasicPersistentProperty.isAssociation() should return false

Referenced from: pull request #183

Backported to: 1.13 RC1 (Ingalls), 1.12.6 (Hopper SR6), 1.11.7 (Gosling SR7)

@spring-projects-issues
Copy link
Author

Oliver Drotbohm commented

I've just committed and back ported a slightly different fix including a test case. We now log those attempts as they indicate a bug in one of the involved modules. Once DATASOLR-341 gets fixed you shouldn't even see that message anymore

@spring-projects-issues spring-projects-issues added type: bug A general bug in: mapping Mapping and conversion infrastructure labels Dec 30, 2020
@spring-projects-issues spring-projects-issues added this to the 2.0 M2 (Kay) milestone Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: mapping Mapping and conversion infrastructure type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants