Prepared declarations collected in the in clause of the datastex Cassandra CQL driver
•
Java
I am trying to run the following query
SELECT edge_id,b_id FROM booking_by_edge WHERE edge_id IN ?
I bind Long's Java list as a parameter, and I get an exception
SyntaxError: line 0:-1 mismatched input '<EOF>' expecting ')' (ResultSetFuture.java:242)
If I try to use (?) It expects a single long item to be bound, but I need a collection
Is there a mistake in my grammar?
Solution
In Cassandra 2.1 3, the following code snippets work as follows:
PreparedStatement prepared = session.prepare("SELECT edge_id,b_id FROM booking_by_edge WHERE edge_id IN ?;"); List<Long> edgeIds = Arrays.asList(1L,2L,3L); session.execute(prepared.bind(edgeIds));
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码