From 38f41d870ee28de236a4bde5fa5331c04771eebf Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Mon, 10 Dec 2007 20:11:22 +0000 Subject: [PATCH] OPENJPA-462: Adding SQLState in DerbyDictionary to demonstrate specialization git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@603028 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/openjpa/jdbc/sql/DBDictionary.java | 6 ++++- .../openjpa/jdbc/sql/DerbyDictionary.java | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java index e83c32e97..585ffd4e1 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java @@ -4033,7 +4033,11 @@ public class DBDictionary * {@link StoreException}.
* JDBC Drivers are not uniform in return values of SQLState for the same * error and hence each database specific Dictionary can specialize.
- * Default behavior is to return an empty list. + * + * + * @return an unmodifiable list of Strings representing supposedly + * uniform SQL States for a given type of StoreException. + * Default behavior is to return an empty list. */ public List/**/ getSQLStates(int exceptionType) { if (exceptionType>=0 && exceptionType + * This method is overwritten to highlight that a) the SQL State is ideally + * uniform across JDBC Drivers but not practically and b) the overwritten + * method must crate a new list to return as the super classes list is + * unmodifable. + */ + public List getSQLStates(int exceptionType) { + List original = super.getSQLStates(exceptionType); + if (exceptionType == StoreException.LOCK) { + // Can not add new codes to unmodifable list of the super class + List newStates = new ArrayList(original); + newStates.add("40XL1"); + return newStates; + } + return original; + } + }