我试图在表'standardevents'中插入一些值。这是执行的查询。
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();
我在执行之前打印查询,我得
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"}')
执行后我得到了一个例外
me.prettyprint.hector.api.exceptions.HInvalidRequestException:
InvalidRequestException(why:line 1:125 mismatched input '(' expecting ')')
但是,当我在cqlsh客户端中运行此查询时,会插入值。 提前致谢。