Uploaded image for project: 'Spring Data for Apache Cassandra'
  1. Spring Data for Apache Cassandra
  2. DATACASS-308

CassandraTemplate.appendIdCriteria throws NullPointerException when using MapId containing unknown property names

    XMLWordPrintable

    Details

      Description

      CassandraTemplate.appendIdCriteria throws NullPointerException when using it together with a MapId but only if the map keys are different from the property names in the given entity.

      Code to reproduce:

      @Table("user_tokens")
      public class UserToken {
      	
      	@PrimaryKeyColumn(name = "the_user_id", type = PrimaryKeyType.PARTITIONED,
      			ordinal = 0) @CassandraType(type = Name.UUID) private UUID userId;
      }
      
      template.selectOneById(UserToken.class, BasicMapId.id("the_user_id", userToken.getUserId()));
      

      leads to:

      java.lang.NullPointerException
      	at org.springframework.data.cassandra.core.CassandraTemplate.appendIdCriteria(CassandraTemplate.java:425)
      	at org.springframework.data.cassandra.core.CassandraTemplate.appendIdCriteria(CassandraTemplate.java:433)
      	at org.springframework.data.cassandra.core.CassandraTemplate.appendIdCriteria(CassandraTemplate.java:466)
      	at org.springframework.data.cassandra.core.CassandraTemplate.selectOneById(CassandraTemplate.java:410)
      

        Attachments

          Activity

            People

            Assignee:
            mp911de Mark Paluch
            Reporter:
            mp911de Mark Paluch
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 21 weeks, 2 days ago