- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Maps failures raised during query execution to the runtime exception thrown to the caller.
The default mapper wraps failures in PersistenceException. Integrations may translate to platform
exception hierarchies instead, such as Spring's DataAccessException.
Exception mappers are configured per ORM template via the template builder; they are deliberately not
discovered through the ServiceLoader mechanism. The framework enriches the failure with SQL diagnostics
(as a suppressed exception on the cause) before invoking the mapper, so the mapper only decides the exception
type that is thrown.
- Since:
- 1.13
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExceptionMapperReturns the default exception mapper.map(Throwable cause, ExceptionContext context) Maps the given failure to the runtime exception that is thrown to the caller.
-
Method Details
-
map
Maps the given failure to the runtime exception that is thrown to the caller.- Parameters:
cause- the failure; typically aSQLExceptionorPersistenceException. The framework has already attached SQL diagnostics as a suppressed exception where available.context- the execution context of the failure; nevernull.- Returns:
- the exception to throw; never
null.
-
defaultMapper
Returns the default exception mapper.The default mapper passes
PersistenceExceptioninstances through unchanged and wraps any other failure in a newPersistenceException.- Returns:
- the default exception mapper.
-