Class RollbackRuleAttribute
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NoRollbackRuleAttribute
Multiple such rules can be applied to determine whether a transaction should commit or rollback after an exception has been thrown.
- Since:
- 09.04.2003
- Author:
- Rod Johnson
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final RollbackRuleAttribute
Therollback rule
forRuntimeExceptions
. -
Constructor Summary
ConstructorDescriptionRollbackRuleAttribute
(Class<?> clazz) Create a new instance of theRollbackRuleAttribute
class.RollbackRuleAttribute
(String exceptionName) Create a new instance of theRollbackRuleAttribute
class for the givenexceptionName
. -
Method Summary
-
Field Details
-
ROLLBACK_ON_RUNTIME_EXCEPTIONS
Therollback rule
forRuntimeExceptions
.
-
-
Constructor Details
-
RollbackRuleAttribute
Create a new instance of theRollbackRuleAttribute
class.This is the preferred way to construct a rollback rule that matches the supplied
Exception
class, its subclasses, and its nested classes.- Parameters:
clazz
- throwable class; must beThrowable
or a subclass ofThrowable
- Throws:
IllegalArgumentException
- if the suppliedclazz
is not aThrowable
type or isnull
-
RollbackRuleAttribute
Create a new instance of theRollbackRuleAttribute
class for the givenexceptionName
.This can be a substring, with no wildcard support at present. A value of "ServletException" would match
jakarta.servlet.ServletException
and subclasses, for example.NB: Consider carefully how specific the pattern is, and whether to include package information (which is not mandatory). For example, "Exception" will match nearly anything, and will probably hide other rules. "java.lang.Exception" would be correct if "Exception" was meant to define a rule for all checked exceptions. With more unusual exception names such as "BaseBusinessException" there's no need to use a fully package-qualified name.
- Parameters:
exceptionName
- the exception name pattern; can also be a fully package-qualified class name- Throws:
IllegalArgumentException
- if the suppliedexceptionName
isnull
or empty
-
-
Method Details
-
getExceptionName
Return the pattern for the exception name. -
getDepth
Return the depth of the superclass matching.0
meansex
matches exactly. Returns-1
if there is no match. Otherwise, returns depth with the lowest depth winning. -
equals
-
hashCode
public int hashCode() -
toString
-