Author: mikedd
Date: Tue May 26 21:49:01 2009
New Revision: 778901

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

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

Modified: 
openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: 
http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?rev=778901&r1=778900&r2=778901&view=diff
==============================================================================
--- 
openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
 (original)
+++ 
openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
 Tue May 26 21:49:01 2009
@@ -475,14 +475,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(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.3.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
URL: 
http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties?rev=778901&r1=778900&r2=778901&view=diff
==============================================================================
--- 
openjpa/branches/1.3.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
 (original)
+++ 
openjpa/branches/1.3.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/localizer.properties
 Tue May 26 21:49:01 2009
@@ -187,4 +187,8 @@
        maximum {2}-character for a sequence name. 
 null-blob-in-not-nullable: Can not set null value on column "{0}" \
        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}.


Reply via email to