2

I am trying to insert some values in table 'standardevents'. This is the query that is executed.

    UUID uuid=new UUID();
    CqlQuery<String,String,String> cqlQuery = new CqlQuery<String,String,String>(keyspace, stringSerializer, stringSerializer, stringSerializer);   
    cqlQuery.setQuery("INSERT INTO standardevents (UUID,time, tracker, type, name, userID, data) VALUES ("+uuid+",dateof(now()),'"+sessId+"', '"+type+"','"+name+"', '"+userid+"','"+data+"')");
    QueryResult<CqlRows<String,String,String>> result = cqlQuery.execute();     

I prints the query before executing,I get

INSERT INTO standardevents (UUID,time, tracker, type, name, userID, data) VALUES (e1319140-4acd-11e3-8015-842b2bab8f61,dateof(now()),'B2FD2CF496E31EC75C33F7A3D55BB800', 'user','coursepage_view', '81','{"courseID":68,"courseDesc":"Quick Start"}')

After Executing I get an excepion

     me.prettyprint.hector.api.exceptions.HInvalidRequestException:
InvalidRequestException(why:line 1:125 mismatched input '(' expecting ')')

But,Values are inserted when i run this query in cqlsh client. Thanks in advance.

Sanil GK
  • 31
  • 4
  • Could you add your table description? Also your version of Cassandra and Hector. – lorcan Nov 11 '13 at 14:19
  • My table description is, UUID timeuuid PRIMARY KEY,time timestamp,tracker varchar,type varchar,name varchar,userID varchar,data varchar. I am using Cassandra version 1.2.2 and hector-core-1.1 – Sanil GK Nov 12 '13 at 04:43
  • Are you using hector-core 1.1-4? – lorcan Nov 12 '13 at 09:38

1 Answers1

1

Hector's CQL is poorly supported and buggy. You should use the native CQL Java driver instead: https://github.com/datastax/java-driver

jbellis
  • 19,347
  • 2
  • 38
  • 47