Skip to content

Instantly share code, notes, and snippets.

@mp911de
Last active May 12, 2016 15:19
Show Gist options
  • Select an option

  • Save mp911de/b61a1a24bd824d0742a6b2e31ecb4861 to your computer and use it in GitHub Desktop.

Select an option

Save mp911de/b61a1a24bd824d0742a6b2e31ecb4861 to your computer and use it in GitHub Desktop.
String id = "1";
long time = 12345L;
// CREATE TABLE timeentity (id varchar PRIMARY KEY, time time);
PreparedStatement prepare = session.prepare("INSERT INTO timeentity (id, time) values(?,?)");
BoundStatement boundStatement = prepare.bind(id, time);
session.execute(boundStatement); // works
Insert insert = QueryBuilder.insertInto("timeentity").value("id", id).value("time", time);
session.execute(insert); // fails with:
// Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Invalid INTEGER constant (21312214) for "time" of type time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment