public void insert(int empId, int deptId, String firstName, String lastName) { try { @SuppressWarnings("unused") OperationResult<CqlResult<Integer, String>> result = keyspace .prepareQuery(EMP_CF) .withCql(INSERT_STATEMENT) .asPreparedStatement() .withIntegerValue(empId) .withIntegerValue(deptId) .withStringValue(firstName) .withStringValue(lastName) .execute(); } catch (ConnectionException e) { logger.error("failed to write data to C*", e); throw new RuntimeException("failed to write data to C*", e); } logger.debug("insert ok"); }
pStatement.withIntegerValue(i).withStringValue(""+i).withLongValue(Long.valueOf(""+i)).execute();