我之前使用过Datastax API,现在转向了spring-data。使用datastax api,我正在使用以下方式进行批处理操作。我需要使用spring-data执行相同的操作。在上传文件时会生成表,因此我没有该表的实体,因此使用对象数组。
BatchStatement batchStatement = new BatchStatement();
PreparedStatement preparedStatement = session.prepare(cqlQuery);
for(Object[] o:batchArgs){
counter++;
batchStatement.add(preparedStatement.bind(o));
}
ResultSet rs = session.execute(batchStatement);