Код: Выделить всё
private List getIds(Jdbi jdbi) {
List ids = new ArrayList();
jdbi.useTransaction(handle -> {
ids = handle.createQuery("select distinct id from table_x where status = 12")
.mapTo(Integer.class)
.list();
});
return ids;
}
< /code>
Тем не менее, это не разрешено (идентификаторы должны быть окончательными или эффективными окончательными.) private List getIds2(Jdbi jdbi) {
AtomicReference result = new AtomicReference(new ArrayList());
jdbi.useTransaction(handle -> {
List ids = handle.createQuery("select distinct id from table_x where status = 12")
.mapTo(Integer.class)
.list();
result.set(ids);
});
return result.get();
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... ion-lambda