From 8ca1c356bec65f45b235ea95edb92f07b461b1e4 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Tue, 6 May 2008 16:23:08 +0000 Subject: Preparations for hiding JDBCRepository class. --- .../repo/jdbc/JDBCConnectionCapability.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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; /** @@ -69,6 +71,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. */ -- cgit v1.2.3