OPENJPA-2034: Update error codes for H2 database.

Submitted By: Prashant Bhat

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1149697 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2011-07-22 19:20:57 +00:00
parent eb4e83fa27
commit 9a974626fd
2 changed files with 18 additions and 4 deletions

View File

@ -33,6 +33,7 @@ import org.apache.openjpa.jdbc.schema.PrimaryKey;
import org.apache.openjpa.jdbc.schema.Table;
import org.apache.openjpa.jdbc.schema.Unique;
import org.apache.openjpa.meta.JavaTypes;
import org.apache.openjpa.util.StoreException;
/**
* Dictionary for H2 ({@link http://www.h2database.com}).
@ -65,6 +66,9 @@ public class H2Dictionary extends DBDictionary {
supportsNullTableForGetPrimaryKeys = true;
supportsNullTableForGetIndexInfo = true;
supportsLockingWithOuterJoin = false;
supportsLockingWithInnerJoin = false;
reservedWordSet.addAll(Arrays.asList(new String[] {
"CURRENT_TIMESTAMP", "CURRENT_TIME", "CURRENT_DATE", "CROSS",
"DISTINCT", "EXCEPT", "EXISTS", "FROM", "FOR", "FALSE", "FULL",
@ -239,4 +243,14 @@ public class H2Dictionary extends DBDictionary {
}
buf.append(")");
}
@Override
public boolean isFatalException(int subtype, SQLException ex) {
int errorCode = ex.getErrorCode();
if ((subtype == StoreException.QUERY || subtype == StoreException.LOCK)
&& (57014 == errorCode || 50200 == errorCode)) {
return false;
}
return super.isFatalException(subtype, ex);
}
}

View File

@ -101,12 +101,12 @@
</dictionary>
<dictionary class="org.apache.openjpa.jdbc.sql.H2Dictionary">
<lock>HYT00</lock>
<referential-integrity>22003,22012,22025,23000,23002,23003</referential-integrity>
<object-exists>23001</object-exists>
<lock>HYT00,57014</lock>
<referential-integrity>22001,22003,22012,22018,22025,23502,23503,23506,23507,23513,23000,23002,23003</referential-integrity>
<object-exists>23001,23505</object-exists>
<object-not-found>02000</object-not-found>
<optimistic></optimistic>
<query>90031</query>
<query>90031,57014</query>
</dictionary>
<dictionary class="org.apache.openjpa.jdbc.sql.HSQLDictionary">