Method creating SQLQuery using querydsl-sql :
protected final <T> T select(RelationalPathBase path, Function<SQLQuery, T> code) throws SQLException {
try (final Connection con = dataSource.getConnection()) {
return code.apply(new SQLQuery(con, SQLServer2008Templates.builder().printSchema().build()).from(getTable(path)));
}
}
Method using query:
public List<Tuple> selectDataForProcess() throws SQLException {
return select(map, sqlQuery -> sqlQuery
.limit(sendSelectBatch)
.where(map.selectedOn.isNull())
.list(map.all()));
}
How can i set timeout for query ?
My problem was in using old version of query-sql. In latest releases timeout can be set like this:
SQLQuery<Tuple> select = queryFactory.select(map.all());
select.setStatementOptions(StatementOptions.builder().setQueryTimeout(queryTimeout).build());