I am using vertx JDBC client pool and trying to insert multiple records to table. The insertion is done successfully but the inserted records are not returned instead only first record is returned.
Code to insert multiple record using batchExecute
List<Tuple> batch = new ArrayList<>();
batch.add(Tuple.of(36,"st","st"));
batch.add(Tuple.of(36,"st1","st1"));
pool.preparedQuery("INSERT INTO table (col1,col2,col3) VALUES($1, $2, $3) returning *").executeBatch(batch,rowSetAsyncResult -> {
System.out.println("size = " + rowSetAsyncResult.result().size()); // this always return 1
for(Row row:rowSetAsyncResult.result()){
System.out.println("id = " + row.getInteger("id"));
}
});
Output
size = 1
id = 87
Table has four columns and one of the column is auto-incremented, thats is why above code is having 3 columns.
Am I missing anything here?