Class DefaultJdbcOptimisticLockingExceptionMapper
- java.lang.Object
-
- org.apache.camel.processor.aggregate.jdbc.DefaultJdbcOptimisticLockingExceptionMapper
-
- All Implemented Interfaces:
JdbcOptimisticLockingExceptionMapper
public class DefaultJdbcOptimisticLockingExceptionMapper extends Object implements JdbcOptimisticLockingExceptionMapper
A defaultJdbcOptimisticLockingExceptionMapper
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)
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 void
addClassName(String name)
static boolean
isConstraintViolation(SQLException e)
boolean
isOptimisticLocking(Exception cause)
Checks the caused exception whether its to be considered as anOptimisticLockingAggregationRepository.OptimisticLockingException
.void
setClassNames(Set<String> names)
-
-
-
Method Detail
-
isOptimisticLocking
public boolean isOptimisticLocking(Exception cause)
Description copied from interface:JdbcOptimisticLockingExceptionMapper
Checks the caused exception whether its to be considered as anOptimisticLockingAggregationRepository.OptimisticLockingException
.- Specified by:
isOptimisticLocking
in 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)
-
-