OPENJPA-1840: handle query timeouts with Sybase - SQLState JZ006:JZ0TO

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1023838 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2010-10-18 15:11:30 +00:00
parent 3707cc8b6d
commit f9cfbbfe2c
2 changed files with 12 additions and 1 deletions

View File

@ -40,6 +40,7 @@ import org.apache.openjpa.lib.jdbc.DelegatingConnection;
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,

View File

@ -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>