Class DefaultJdbcOptimisticLockingExceptionMapper
- java.lang.Object
-
- org.apache.camel.processor.aggregate.jdbc.DefaultJdbcOptimisticLockingExceptionMapper
-
- All Implemented Interfaces:
JdbcOptimisticLockingExceptionMapper
public class DefaultJdbcOptimisticLockingExceptionMapper extends Object implements JdbcOptimisticLockingExceptionMapper
A defaultJdbcOptimisticLockingExceptionMapperwhich 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)orsetClassNames(java.util.Set)methods. These class names is also matched. This allows to add vendor specific exception classes.
-
-
Constructor Summary
Constructors Constructor Description DefaultJdbcOptimisticLockingExceptionMapper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClassName(String name)static booleanisConstraintViolation(SQLException e)booleanisOptimisticLocking(Exception cause)Checks the caused exception whether its to be considered as anOptimisticLockingAggregationRepository.OptimisticLockingException.voidsetClassNames(Set<String> names)
-
-
-
Method Detail
-
isOptimisticLocking
public boolean isOptimisticLocking(Exception cause)
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
public static boolean isConstraintViolation(SQLException e)
-
addClassName
public void addClassName(String name)
-
-