public abstract class AbstractFallbackSQLExceptionTranslator extends ObjectSE implements SQLExceptionTranslator
SQLExceptionTranslator へのフォールバックを可能にする SQLExceptionTranslator 実装の基本クラス。| コンストラクターと説明 |
|---|
AbstractFallbackSQLExceptionTranslator() |
| 修飾子と型 | メソッドと説明 |
|---|---|
protected StringSE | buildMessage(StringSE task, StringSE sql, SQLExceptionSE ex) 指定された SQLExceptionSE のメッセージ String を作成します。 |
protected abstract DataAccessException | doTranslate(StringSE task, StringSE sql, SQLExceptionSE ex) 指定された例外を実際に変換するためのテンプレートメソッド。 |
SQLExceptionTranslator | getFallbackTranslator() フォールバック例外トランスレーターがあれば、それを返します。 |
void | setFallbackTranslator(SQLExceptionTranslator fallback) デフォルトの SQL 状態フォールバックトランスレーター(通常は SQLStateSQLExceptionTranslator)をオーバーライドします。 |
DataAccessException | translate(StringSE task, StringSE sql, SQLExceptionSE ex) 引数を事前チェックし、 doTranslate(java.lang.String, java.lang.String, java.sql.SQLException) を呼び出し、必要に応じて fallback translator を呼び出します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEprotected final Log logger
public void setFallbackTranslator(@Nullable SQLExceptionTranslator fallback)
SQLStateSQLExceptionTranslator)をオーバーライドします。@Nullable public SQLExceptionTranslator getFallbackTranslator()
@Nullable public DataAccessException translate(StringSE task, @Nullable StringSE sql, SQLExceptionSE ex)
doTranslate(java.lang.String, java.lang.String, java.sql.SQLException) を呼び出し、必要に応じて fallback translator を呼び出します。SQLExceptionTranslator 内の translate task - 試行されているタスクを説明する読み取り可能なテキスト sql - 問題を引き起こした SQL クエリまたは更新 (既知の場合)ex - 問題のある SQLExceptionSQLException をラップする DataAccessException、または特定の変換を適用できない場合は null NestedRuntimeException.getRootCause()@Nullable protected abstract DataAccessException doTranslate(StringSE task, @Nullable StringSE sql, SQLExceptionSE ex)
渡された引数は事前にチェックされています。さらに、このメソッドは null を返し、例外の一致が見つからなかったこと、およびフォールバック変換が開始されることを示すことができます。
task - 試行されているタスクを説明する読み取り可能なテキスト sql - 問題を引き起こした SQL クエリまたは更新 (既知の場合)ex - 問題のある SQLExceptionSQLException をラップする DataAccessException。例外一致が見つからない場合は null protected StringSE buildMessage(StringSE task, @Nullable StringSE sql, SQLExceptionSE ex)
SQLExceptionSE のメッセージ String を作成します。 ジェネリクス DataAccessException クラスのインスタンスを作成するときに、トランスレータサブクラスによって呼び出されます。
task - 試行されているタスクを説明する読み取り可能なテキスト sql - 問題の原因となった SQL ステートメント ex - 問題のある SQLExceptionString