cassandra multi column in binding java datastax driver

i have problems to bind a list of multi-column cluster-keys to a statement with an IN clause.

the example can be exactly the one given in https://www.datastax.com/dev/blog/a-deep-look-to-the-cql-where-clause (section IN “restrictions”):

SELECT * FROM numberOfRequests
    WHERE cluster = ‘cluster1’
    AND date = ‘2015-06-05’
    AND datacenter = 'US_WEST_COAST'
    AND (hour, minute) IN ((14, 0), (15, 0));

as a prepared statement this looks like:

PreparedStatement preparedStatement = session.prepare(
"SELECT * FROM numberOfRequests
    WHERE cluster = ‘cluster1’
    AND date = ‘2015-06-05’
    AND datacenter = 'US_WEST_COAST'
    AND (hour, minute) IN (?);")

lets say we have:

  int[][] hourMinuteArray = {{1,30},{4,45},{5,50}};

how to do the binding of the list of multi-column keys to the statement :

preparedStatement.bind( ???? ) or boundStatemeent.set?( ???? )

btw: it works if for one-column cluster-key lists

Update your prepared statement change (?) to just ? like below :

PreparedStatement preparedStatement = session.prepare(
        "SELECT * FROM numberOfRequests " +
                "WHERE cluster = cluster1 " +
                "AND date = '2015-06-05' " +
                "AND datacenter = 'US_WEST_COAST' " +
                "AND (hour, minute) IN ?"
);

The value you want to bind is a List of TupleValue. First you have to create a tuple of (int, int)

TupleType intTuple = cluster.getMetadata().newTupleType(DataType.cint(), DataType.cint());

Create the list of Tuple

List<TupleValue> list = Arrays.asList(
        intTuple.newValue(1, 30), 
        intTuple.newValue(4, 45),
        intTuple.newValue(5, 50) 
);

Now you can bind the list.

preparedStatement.bind(list);