Skip to content
Snippets Groups Projects
Commit f8029d14 authored by brinn's avatar brinn
Browse files

Remove a workaround for setting a query timeout that was PostgreSQL specific...

Remove a workaround for setting a query timeout that was PostgreSQL specific (i.e. broke functionality with Oracle) and that is now no longer needed as the current PostgreSQL JDBC driver works fine with Statement.setQueryTimeout().

SVN: 27599
parent f954616b
No related merge requests found
...@@ -60,9 +60,7 @@ class DAO extends SimpleJdbcDaoSupport implements IDAO ...@@ -60,9 +60,7 @@ class DAO extends SimpleJdbcDaoSupport implements IDAO
private static final int MAX_ROWS = 100 * FETCH_SIZE; // 100.000 private static final int MAX_ROWS = 100 * FETCH_SIZE; // 100.000
private static final long MINUTE_MILIS = 60 * 1000; private static final int QUERY_TIMEOUT_SECS = 5 * 60; // 5 minutes
private static final long QUERY_TIMEOUT_MILIS = 10 * MINUTE_MILIS;
private static final String ENTITY_COLUMN_NAME_SUFFIX = "_KEY"; private static final String ENTITY_COLUMN_NAME_SUFFIX = "_KEY";
...@@ -194,10 +192,7 @@ class DAO extends SimpleJdbcDaoSupport implements IDAO ...@@ -194,10 +192,7 @@ class DAO extends SimpleJdbcDaoSupport implements IDAO
final JdbcTemplate template = getJdbcTemplate(); final JdbcTemplate template = getJdbcTemplate();
template.setFetchSize(FETCH_SIZE); template.setFetchSize(FETCH_SIZE);
template.setMaxRows(MAX_ROWS + 1); // fetch one more row than allowed to detect excess template.setMaxRows(MAX_ROWS + 1); // fetch one more row than allowed to detect excess
// WORKAROUND setQueryTimeout(int) is not implemented in the JDBC driver for PostgreSQL template.setQueryTimeout(QUERY_TIMEOUT_SECS);
// NOTE: This fallback solution is PostgreSQL specific!
// Setting timeout only once to all statements executed by this DAO doesn't seem to work.
template.execute("SET statement_timeout TO " + QUERY_TIMEOUT_MILIS);
final String resolvedQuery = createSQLQueryWithBindingsResolved(sqlQuery, bindingsOrNull); final String resolvedQuery = createSQLQueryWithBindingsResolved(sqlQuery, bindingsOrNull);
return (TableModel) template.execute(resolvedQuery, callback); return (TableModel) template.execute(resolvedQuery, callback);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment