クラス ChainedPersistenceExceptionTranslator

java.lang.ObjectSE
org.springframework.dao.support.ChainedPersistenceExceptionTranslator
実装されたすべてのインターフェース:
PersistenceExceptionTranslator

public class ChainedPersistenceExceptionTranslator extends ObjectSE implements PersistenceExceptionTranslator
チェーンをサポートする PersistenceExceptionTranslator の実装。PersistenceExceptionTranslator インスタンスを順番に追加できます。最初の一致があれば non-null を返します。
導入:
2.0
作成者:
Rod Johnson, Juergen Hoeller
  • コンストラクターの詳細

    • ChainedPersistenceExceptionTranslator

      public ChainedPersistenceExceptionTranslator()
  • メソッドの詳細

    • addDelegate

      public final void addDelegate(PersistenceExceptionTranslator pet)
      PersistenceExceptionTranslator を連鎖デリゲートリストに追加します。
    • getDelegates

      public final PersistenceExceptionTranslator[] getDelegates()
      すべての登録済み PersistenceExceptionTranslator デリゲートを(配列として)返します。
    • translateExceptionIfPossible

      @Nullable public DataAccessException translateExceptionIfPossible(RuntimeExceptionSE ex)
      インターフェースからコピーされた説明: PersistenceExceptionTranslator
      可能であれば、永続フレームワークによってスローされた特定のランタイム例外を、Spring の汎用 DataAccessException 階層からの対応する例外に変換します。

      このトランスレータが理解できない例外は変換しないでください。たとえば、別の永続化フレームワークが原因である場合や、ユーザーコードが原因である場合や、永続性に関係のない場合などです。

      特に重要なのは、制約違反などで、DataIntegrityViolationException に正しく変換することです。実装では、Spring JDBC の高度な例外変換を使用して、根本的な原因として SQLException のイベントに関する詳細情報を提供できます。

      次で指定:
      インターフェース PersistenceExceptionTranslatortranslateExceptionIfPossible 
      パラメーター:
      ex - 変換する RuntimeException
      戻り値:
      対応する DataAccessException (または、例外を変換できなかった場合は null。この場合、実際の永続性の問題ではなく、ユーザーコードが原因である可能性があります。)
      関連事項: