Class DefaultJdbcOptimisticLockingExceptionMapper
java.lang.Object
org.apache.camel.processor.aggregate.jdbc.DefaultJdbcOptimisticLockingExceptionMapper
- All Implemented Interfaces:
JdbcOptimisticLockingExceptionMapper
public class DefaultJdbcOptimisticLockingExceptionMapper
extends Object
implements JdbcOptimisticLockingExceptionMapper
A default
JdbcOptimisticLockingExceptionMapper which checks the caused exception (and its nested) whether any
of them is a constraint violation exception.
The following check is done:
- If the caused exception is an
SQLException then the SQLState is checked if starts with 23.
- If the caused exception is a
DataIntegrityViolationException - If the caused exception class name has ConstraintViolation in its name.
- optional checking for FQN class name matches if any class names has been configured
addClassName(String) or
setClassNames(java.util.Set) methods. These class names is also matched. This allows to add vendor specific
exception classes.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClassName(String name) static booleanbooleanisOptimisticLocking(Exception cause) Checks the caused exception whether its to be considered as anOptimisticLockingAggregationRepository.OptimisticLockingException.voidsetClassNames(Set<String> names)
-
Constructor Details
-
DefaultJdbcOptimisticLockingExceptionMapper
public DefaultJdbcOptimisticLockingExceptionMapper()
-
-
Method Details
-
isOptimisticLocking
Description copied from interface:JdbcOptimisticLockingExceptionMapperChecks the caused exception whether its to be considered as anOptimisticLockingAggregationRepository.OptimisticLockingException.- Specified by:
isOptimisticLockingin interfaceJdbcOptimisticLockingExceptionMapper- Parameters:
cause- the caused exception- Returns:
- true if the caused should be rethrown as an
OptimisticLockingAggregationRepository.OptimisticLockingException.
-
isConstraintViolation
-
addClassName
-
setClassNames
-