Uploaded image for project: 'Spring Data Commons'
  1. Spring Data Commons
  2. DATACMNS-934

BasicPersistentEntity.addAssociations(…) must not add null values to the collection of associations

    XMLWordPrintable

    Details

      Description

      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)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              davidrodriguezpolo David Rodriguez Polo
              Last updater:
              Spring Issues Spring Issues
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1d
                  1d
                  Remaining:
                  Remaining Estimate - 1d
                  1d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified