incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaron morton <aa...@thelastpickle.com>
Subject Re: Insert into column which is of DateType
Date Wed, 24 Apr 2013 03:04:37 GMT
Have you tried to Astyanax example and use the Date override ? 

https://github.com/Netflix/astyanax/wiki/Writing-data
http://netflix.github.io/astyanax/javadoc/com/netflix/astyanax/ColumnMutation.html#putValue(java.util.Date,
java.lang.Integer)

Cheers

-----------------
Aaron Morton
Freelance Cassandra Consultant
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 23/04/2013, at 3:23 PM, Techy Teck <comptechgeeky@gmail.com> wrote:

> I created my column family in Cassandra database like this from the CLI-
> 
> create column family PROFILE
> with key_validation_class = 'UTF8Type'
> and comparator = 'UTF8Type'
> and default_validation_class = 'UTF8Type'
> and column_metadata = [
>   {column_name : lmd, validation_class : 'DateType'}
> ];
> 
> 
> Now I was trying to insert into above lmd columns using few of the
> clients like Netflix/Pelops/Datastax
> 
> I am not sure how to insert into columns which is of DateType. I was using the below
code to insert
> into lmd column.
> 
> 
> final long LMD = System.currentTimeMillis() / 1000L;
> 
> attrMap.put("lmd", String.valueOf(LMD));
> 
> And everytime, I get exception as -
> 
> (Expected 8 or 0 byte long for date (30)) [my_keyspace][PROFILE][lmd] failed validation
> 
> Is there anything wrong I am doing?
> 
> attrMap is String, String here. And then I am using this map later on to retrieve the
column and then populate it into cassandra database


Mime
View raw message