cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amila Paranawithana <amila1...@gmail.com>
Subject Java Driver 2.1 reading counter values from row
Date Fri, 27 Mar 2015 09:21:41 GMT
in Apache Cassandra Java Driver 2.1 how to read counter type values from a
row when iterating over result set.

eg: If I have a counter table called 'countertable' with key and a counter
colum 'sum' how can I read the value of the counter column using Java
driver?
If I say, row.getInt("sum") this gives the following error,

com.datastax.driver.core.exceptions.InvalidTypeException: Value sum is of
type counter

Code ::

ResultSet results = session.execute("SELECT * FROM simplex.countertable ")

for (Row row : results) {
    System.out.println(row.getString("key"),row.getInt("sum")));
}

Thanks,
Amila


-- 

 *Amila Iroshani Paranawithana , **Senior Software Engineer* *, AdroitLogic
<http://adroitlogic.org>*
  | ☎: +94779747398
| ✍:  http://amilaparanawithana.blogspot.com
[image: Facebook] <https://www.facebook.com/amila.paranawithana> [image:
Twitter] <https://twitter.com/AmilaPara> [image: LinkedIn]
<http://www.linkedin.com/profile/view?id=66289851&trk=tab_pro> [image:
Skype] amila.paranawithana
​

Mime
View raw message