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:17 UTC

svn commit: r778902 - in /openjpa/branches/1.2.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:16 2009
New Revision: 778902

URL: http://svn.apache.org/viewvc?rev=778902&view=rev
Log:
OPENJPA-1067. Merely log SQLException from setQueryTimeout for DB2 on Z/OS

Modified:
    openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
    openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties

Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?rev=778902&r1=778901&r2=778902&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java (original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java Tue May 26 21:49:16 2009
@@ -476,13 +476,26 @@
         if (forUpdate && _dict.supportsQueryTimeout && fetch != null 
             && fetch.getLockTimeout() > stmnt.getQueryTimeout() * 1000) {
             int timeout = fetch.getLockTimeout();
+            Log log = _conf.getLog(JDBCConfiguration.LOG_JDBC);
             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);
+            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;
+                }
+            }
         }
     }
 

Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties?rev=778902&r1=778901&r2=778902&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties (original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties Tue May 26 21:49:16 2009
@@ -176,4 +176,10 @@
 connection-defaults: Initial connection autoCommit: {0}, holdability: {1}, \
     TransactionIsolation: {2}
 null-blob-in-not-nullable: Can not set null value on column "{0}" \
-	because the corresponding field is set to be non-nullable.
\ No newline at end of file
+	because the corresponding field is set to be non-nullable.
+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