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)
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
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 toSimpleSolrPersistentEntity
, this sets tonull
the property association onAbstractPersistentProperty
. Then, when you make a search with Spring Data Solr and try to get thehasScoreProperty()
this throws aNullPointerException
.Affects: 1.13 M1 (Ingalls), 1.11.6 (Gosling SR6), 1.12.5 (Hopper SR5), 2.0 M1 (Kay)
Issue Links:
Referenced from: pull request #183
Backported to: 1.13 RC1 (Ingalls), 1.12.6 (Hopper SR6), 1.11.7 (Gosling SR7)
The text was updated successfully, but these errors were encountered: