/** * FIXME - OPENJPA-957 - lockTimeout is a server-side function and * shouldn't be using client-side setQueryTimeout for lock timeouts. * * This method is to provide override for non-JDBC or JDBC-like * implementation of setting query and lock timeouts. * * @param stmnt * @param fetch - optional lock and query timeouts in milliseconds * @param forUpdate - true if we should also try setting a lock timeout * @throws SQLException */ public void setTimeouts(PreparedStatement stmnt, JDBCFetchConfiguration fetch, boolean forUpdate) throws SQLException { if (supportsQueryTimeout) { int timeout = fetch.getQueryTimeout(); if (forUpdate) { // if this is a locking select and the lock timeout is greater // than the configured query timeout, use the lock timeout timeout = Math.max(fetch.getQueryTimeout(), fetch.getLockTimeout()); } setQueryTimeout(stmnt, timeout); } }
/** * FIXME - OPENJPA-957 - lockTimeout is a server-side function and * shouldn't be using client-side setQueryTimeout for lock timeouts. * * This method is to provide override for non-JDBC or JDBC-like * implementation of setting query and lock timeouts. * * @param stmnt * @param fetch - optional lock and query timeouts in milliseconds * @param forUpdate - true if we should also try setting a lock timeout * @throws SQLException */ public void setTimeouts(PreparedStatement stmnt, JDBCFetchConfiguration fetch, boolean forUpdate) throws SQLException { if (supportsQueryTimeout) { int timeout = fetch.getQueryTimeout(); if (forUpdate) { // if this is a locking select and the lock timeout is greater // than the configured query timeout, use the lock timeout timeout = Math.max(fetch.getQueryTimeout(), fetch.getLockTimeout()); } setQueryTimeout(stmnt, timeout); } }
/** * FIXME - OPENJPA-957 - lockTimeout is a server-side function and * shouldn't be using client-side setQueryTimeout for lock timeouts. * * This method is to provide override for non-JDBC or JDBC-like * implementation of setting query and lock timeouts. * * @param stmnt * @param fetch - optional lock and query timeouts in milliseconds * @param forUpdate - true if we should also try setting a lock timeout * @throws SQLException */ public void setTimeouts(PreparedStatement stmnt, JDBCFetchConfiguration fetch, boolean forUpdate) throws SQLException { if (supportsQueryTimeout) { int timeout = fetch.getQueryTimeout(); if (forUpdate) { // if this is a locking select and the lock timeout is greater // than the configured query timeout, use the lock timeout timeout = Math.max(fetch.getQueryTimeout(), fetch.getLockTimeout()); } setQueryTimeout(stmnt, timeout); } }
/** * FIXME - OPENJPA-957 - lockTimeout is a server-side function and * shouldn't be using client-side setQueryTimeout for lock timeouts. * * This method is to provide override for non-JDBC or JDBC-like * implementation of setting query and lock timeouts. * * @param stmnt * @param fetch - optional lock and query timeouts in milliseconds * @param forUpdate - true if we should also try setting a lock timeout * @throws SQLException */ public void setTimeouts(PreparedStatement stmnt, JDBCFetchConfiguration fetch, boolean forUpdate) throws SQLException { if (supportsQueryTimeout) { int timeout = fetch.getQueryTimeout(); if (forUpdate) { // if this is a locking select and the lock timeout is greater // than the configured query timeout, use the lock timeout timeout = Math.max(fetch.getQueryTimeout(), fetch.getLockTimeout()); } setQueryTimeout(stmnt, timeout); } }
/** * This method is to provide override for non-JDBC or JDBC-like * implementation of setting query timeout. */ protected void setTimeout(PreparedStatement stmnt, boolean forUpdate, JDBCFetchConfiguration fetch) throws SQLException { // if this is a locking select and the lock timeout is greater than // the configured query timeout, use the lock timeout if (forUpdate && _dict.supportsQueryTimeout && fetch != null && fetch.getLockTimeout() > stmnt.getQueryTimeout() * 1000) { int timeout = fetch.getLockTimeout(); if (timeout < 1000) { timeout = 1000; Log log = _conf.getLog(JDBCConfiguration.LOG_JDBC); if (log.isWarnEnabled()) log.warn(_loc.get("millis-query-timeout")); } stmnt.setQueryTimeout(timeout / 1000); } }