PersistenceExceptionTranslator that supports chaining,
allowing the addition of PersistenceExceptionTranslator instances in order.
Returns non-null on the first (if any) match.
| Modifier and Type | Field and Description |
|---|---|
| private final List | delegates
List of PersistenceExceptionTranslators. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final void | addDelegate(PersistenceExceptionTranslator pet)
Add a PersistenceExceptionTranslator to the chained delegate list. |
| public final PersistenceExceptionTranslator[] | |
| public DataAccessException | translateExceptionIfPossible(RuntimeException
a RuntimeException to translate ex)Implements org. Translate the given runtime exception thrown by a persistence framework to a
corresponding exception from Spring's generic
|
| delegates | back to summary |
|---|---|
| private final List<PersistenceExceptionTranslator> delegates List of PersistenceExceptionTranslators. | |
| ChainedPersistenceExceptionTranslator | back to summary |
|---|---|
| public ChainedPersistenceExceptionTranslator() | |
| addDelegate | back to summary |
|---|---|
| public final void addDelegate(PersistenceExceptionTranslator pet) Add a PersistenceExceptionTranslator to the chained delegate list. | |
| getDelegates | back to summary |
|---|---|
| public final PersistenceExceptionTranslator[] getDelegates() Return all registered PersistenceExceptionTranslator delegates (as array). | |
| translateExceptionIfPossible | back to summary |
|---|---|
| public DataAccessException translateExceptionIfPossible(RuntimeException ex) Implements org. Doc from org. Translate the given runtime exception thrown by a persistence framework to a
corresponding exception from Spring's generic
Do not translate exceptions that are not understood by this translator: for example, if coming from another persistence framework, or resulting from user code or otherwise unrelated to persistence. Of particular importance is the correct translation to DataIntegrityViolationException, for example on constraint violation. Implementations may use Spring JDBC's sophisticated exception translation to provide further information in the event of SQLException as a root cause.
| |