summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-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();