title: Cassandra counter datatype operation in spring repository
body: <p>I have a spring-boot application in which I want to create Cassandra <strong>counter</strong> tables if not exist. I am using the repository for the same.</p>
  
  <p><strong>UserPoints POJO:</strong> </p>
  
  <pre><code>/**
   * 
   * @author Prakash Pandey 23-Nov-2017
   *
   */
  @Table("user_points")
  public class UserPoints {
  
      @PrimaryKeyColumn(name = "app_id", ordinal = 0, type = PrimaryKeyType.PARTITIONED)
      private long appId;
  
      @PrimaryKeyColumn(name = "user_name", ordinal = 0, type = PrimaryKeyType.CLUSTERED)
      private String userName;
  
      @Column(value = "points")
      long points;
  
  
      public long getAppId() {
          return appId;
      }
  
      public void setAppId(long appId) {
          this.appId = appId;
      }
  
      public long getPoints() {
          return points;
      }
  
      public void setPoints(long points) {
          this.points = points;
      }
  
      public String getUserName() {
          return userName;
      }
  
      public void setUserName(String userName) {
          this.userName = userName;
      }
  
      @Override
      public String toString() {
          return "UserPoints [appId=" + appId + ", userName=" + userName + ", points=" + points + "]";
      }
  }
  </code></pre>
  
  <p><strong>UserPointRepository POJO:</strong></p>
  
  <pre><code>@Repository
  public interface UserPointRepository extends CassandraRepository&lt;UserPoints&gt; {
  
  }
  </code></pre>
  
  <p>The table was created successfully in Cassandra database with the below definition : </p>
  
  <pre><code>CREATE TABLE user_points (
    app_id bigint,
    user_name text,
    points bigint,
    PRIMARY KEY (app_id, user_name)
  )
  </code></pre>
  
  <p><strong>The problem</strong> is that data type of <code>points</code> column is <code>bigint</code>, expected is <code>counter</code> data-type. </p>
  
  <p><strong>I have two questions</strong>: </p>
  
  <ol>
  <li>How to create a counter(column having counter
  datatype) table using the repository.</li>
  <li>How to update (increment, decrement) a counter column using the
  repository.</li>
  </ol>