summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-05-06 16:23:08 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-05-06 16:23:08 +0000
commit8ca1c356bec65f45b235ea95edb92f07b461b1e4 (patch)
tree6a0e696eac018791f0feec1b4836785e781f53f2 /src/main/java/com
parent36ad3c8bebb5b216199132b06aab31e1e561fc8c (diff)
Preparations for hiding JDBCRepository class.
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/amazon/carbonado/repo/jdbc/JDBCConnectionCapability.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCConnectionCapability.java b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCConnectionCapability.java
index dbde10e..34c63a6 100644
--- a/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCConnectionCapability.java
+++ b/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCConnectionCapability.java
@@ -19,8 +19,10 @@
package com.amazon.carbonado.repo.jdbc;
import java.sql.Connection;
+import java.sql.SQLException;
import com.amazon.carbonado.FetchException;
+import com.amazon.carbonado.PersistException;
import com.amazon.carbonado.capability.Capability;
/**
@@ -70,6 +72,41 @@ public interface JDBCConnectionCapability extends Capability {
void yieldConnection(Connection con) throws FetchException;
/**
+ * Transforms the given throwable into an appropriate fetch exception. If
+ * it already is a fetch exception, it is simply casted.
+ *
+ * @param e required exception to transform
+ * @return FetchException, never null
+ * @since 1.2
+ */
+ FetchException toFetchException(Throwable e);
+
+ /**
+ * Transforms the given throwable into an appropriate persist exception. If
+ * it already is a persist exception, it is simply casted.
+ *
+ * @param e required exception to transform
+ * @return PersistException, never null
+ * @since 1.2
+ */
+ PersistException toPersistException(Throwable e);
+
+ /**
+ * Examines the SQLSTATE code of the given SQL exception and determines if
+ * it is a unique constaint violation.
+ *
+ * @since 1.2
+ */
+ boolean isUniqueConstraintError(SQLException e);
+
+ /**
+ * Returns true if a transaction is in progress and it is for update.
+ *
+ * @since 1.2
+ */
+ boolean isTransactionForUpdate();
+
+ /**
* Returns the name of the database product connected to.
*/
String getDatabaseProductName();