Http Cassandra插入:InvalidQueryException:列的条件中的空值无效
大家好,我开始使用Cassandra,我正在尝试使用DropWizard创建的REST服务器中的Java代码将数据插入Cassandra表Http Cassandra插入:InvalidQueryException:列的条件中的空值无效,http,cassandra,dropwizard,Http,Cassandra,Dropwizard,大家好,我开始使用Cassandra,我正在尝试使用DropWizard创建的REST服务器中的Java代码将数据插入Cassandra表 public int insertqueueid(Datafilter data) throws UnknownHostException { PreparedStatement prep = defaultSession.prepare("insert into queueid (queueid, filter, nom, dat
public int insertqueueid(Datafilter data) throws UnknownHostException
{
PreparedStatement prep = defaultSession.prepare("insert into queueid (queueid, filter, nom, date) values (?,?,?,?)");
BoundStatement bound = prep.bind(data.getQueued(),data.getFilter(),getName(), new Date()) ;
defaultSession.execute(bound);
return 0 ;
}
但它给了我一个错误:
错误[2017-07-03 23:45:57514]io.dropwizard.jersey.errors.LoggingExceptionApper:处理请求时出错:5d2d169dd71c2520
! com.datastax.driver.core.exceptions.InvalidQueryException:列queueid的条件中存在无效的null值
! 位于com.datastax.driver.core.Responses$Error.asException(Responses.java:136)
! 位于com.datastax.driver.core.DefaultResultSetFuture.start(DefaultResultSetFuture.java:179)
! 位于com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:177)
你认为问题出在哪里?抱歉,语言错误基于此错误,似乎将NULL值传递到queueid列。我假设它是表的分区键,不能为该列传递NULL
请检查数据并进行相应的修复。基于此错误,似乎将NULL值传递给queueid列。我假设它是表的分区键,不能为该列传递NULL
请检查数据并进行相应的修复。如果是Rest调用,请按如下方法添加
@RequestBody
public int insertqueueid(@RequestBody Datafilter data) throws UnknownHostException
如果是Rest调用,请按如下方法添加
@RequestBody
public int insertqueueid(@RequestBody Datafilter data) throws UnknownHostException
是的,你是对的,我做的请求是发送空值,我修复了它,谢谢你是对的,我做的请求是发送空值,我修复了它,thanks@dilsingi,先生,我的源数据中没有任何为空的列,但我仍收到错误………..错误查询执行器:72-无法执行:com.datastax.spark.connector.writer。RichBoundStatement@397a85f3com.datastax.driver.core.exceptions.InvalidQueryException:列的条件中的空值无效com.datastax.driver.core.Responses$Error.asException(Responses.java:136)上的财政年度,位于com.datastax.driver.core.DefaultResultSetFuture上。onSet@dilsingi,先生,我的源数据中没有任何为空的列,但我仍收到错误………..错误查询执行器:72-无法执行:com.datastax.spark.connector.writer。RichBoundStatement@397a85f3com.datastax.driver.core.exceptions.InvalidQueryException:列的条件中的空值无效com.datastax.driver.core.Responses$Error.asException(Responses.java:136)中的财政年度,位于com.datastax.driver.core.DefaultResultSetFuture.start