You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by mi...@apache.org on 2009/05/26 23:49:33 UTC
svn commit: r778903 - in /openjpa/branches/1.0.x/openjpa-jdbc/src/main:
java/org/apache/openjpa/jdbc/sql/SelectImpl.java
resources/org/apache/openjpa/jdbc/sql/localizer.properties
Author: mikedd
Date: Tue May 26 21:49:33 2009
New Revision: 778903
URL: http://svn.apache.org/viewvc?rev=778903&view=rev
Log:
OPENJPA-1067. Merely log SQLException from setQueryTimeout for DB2 on Z/OS
Modified:
openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?rev=778903&r1=778902&r2=778903&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java (original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java Tue May 26 21:49:33 2009
@@ -360,14 +360,27 @@
// the configured query timeout, use the lock timeout
if (forUpdate && _dict.supportsQueryTimeout && fetch != null
&& fetch.getLockTimeout() > stmnt.getQueryTimeout() * 1000) {
+ Log log = _conf.getLog(JDBCConfiguration.LOG_JDBC);
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(fetch.getLockTimeout() / 1000);
+ try {
+ stmnt.setQueryTimeout(fetch.getLockTimeout() / 1000);
+ }
+ catch(SQLException e) {
+ if(_dict.ignoreSQLExceptionOnSetQueryTimeout) {
+ if (log.isTraceEnabled()) {
+ log.trace(_loc.get("error-setting-query-timeout",
+ new Integer(timeout), e.getMessage()), e);
+ }
+ }
+ else {
+ throw e;
+ }
+ }
}
rs = stmnt.executeQuery();
} catch (SQLException se) {
Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties?rev=778903&r1=778902&r2=778903&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties (original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties Tue May 26 21:49:33 2009
@@ -167,5 +167,11 @@
customization of isolation levels on a per-query basis. DBDictionary: {0}.
millis-query-timeout: JDBC locking does not support millisecond-granularity \
timeouts. Use timeouts that are multiples of 1000 for even second values.
-db-not-supported: The database product "{0}", version "{1}" is not officially supported.
+db-not-supported: The database product "{0}", version "{1}" is not officially \
+ supported.
+error-setting-query-timeout: A SQLException was thrown when trying to set the \
+ queryTimeout to {0}. We believe the exception is not fatal and will \
+ continue processing. If this is a benign error you may disable it entirely \
+ by setting the supportsQueryTimeout attribute on the DBDictionary to false.\
+ The exception thrown was {1}.
\ No newline at end of file