1

I want to change following query to prepared statement :

QueryBuilder.select().column(id).from(studentTable).where(QueryBuilder.in(id,List)).

I know noramlly this query can be written as :

select id from studentTable where id = ?

How the same can be achieved by querybuilder ?

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
S.P.
  • 185
  • 19

1 Answers1

1

To achieve this with QueryBuilder you need to call the bindMarker(), or bindMarker("name")... See corresponding Javadocs (example is from it):

Insert i = QueryBuilder.insertInto("test").value("k", 0)
                       .value("c", QueryBuilder.bindMarker());
PreparedStatement p = session.prepare(i.toString());
Alex Ott
  • 80,552
  • 8
  • 87
  • 132