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 2010/10/18 17:11:31 UTC

svn commit: r1023838 - in /openjpa/trunk/openjpa-jdbc/src/main: java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml

Author: mikedd
Date: Mon Oct 18 15:11:30 2010
New Revision: 1023838

URL: http://svn.apache.org/viewvc?rev=1023838&view=rev
Log:
OPENJPA-1840: handle query timeouts with Sybase - SQLState JZ006:JZ0TO

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java?rev=1023838&r1=1023837&r2=1023838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SybaseDictionary.java Mon Oct 18 15:11:30 2010
@@ -40,6 +40,7 @@ import org.apache.openjpa.lib.jdbc.Deleg
 import org.apache.openjpa.lib.util.ConcreteClassGenerator;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.meta.JavaTypes;
+import org.apache.openjpa.util.StoreException;
 
 /**
  * Dictionary for Sybase.
@@ -407,6 +408,16 @@ public class SybaseDictionary
         idx.setUnique(!getBooleanFromResultSet(idxMeta, "NON_UNIQUE", "non_unique"));
         return idx;
     }
+    
+    public boolean isFatalException(int subtype, SQLException ex) {
+        if (subtype == StoreException.LOCK) {
+            SQLException next = ex.getNextException();
+            if("JZ0TO".equals(next.getSQLState())) {
+                return false; // query timeout
+            }
+        }
+        return super.isFatalException(subtype, ex); 
+    }
 
     /**
      * Connection wrapper to cache the {@link Connection#getCatalog} result,

Modified: openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml?rev=1023838&r1=1023837&r2=1023838&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml Mon Oct 18 15:11:30 2010
@@ -56,7 +56,7 @@
 	</dictionary>
 	
 	<dictionary class="org.apache.openjpa.jdbc.sql.SybaseDictionary">
-		<lock>1204,1205,1279</lock>
+		<lock>1204,1205,1279, JZ006</lock>
 		<referential-integrity>423,511,515,530,547,2601,2615,2714</referential-integrity>
 		<object-exists>23000</object-exists>
 		<object-not-found></object-not-found>