42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
When using Spring proxies, calling a method in the same class (e.g. ``++this.aMethod()++``) with an incompatible ``++@Transactional++`` requirement will result in runtime exceptions because Spring only "sees" the caller and makes no provisions for properly invoking the callee.
|
|
|
|
|
|
Therefore, certain calls should never be made within the same class:
|
|
|
|
||From||To||
|
|
|
|
| non-``++@Transactional++`` | MANDATORY, NESTED, REQUIRED, REQUIRES_NEW |
|
|
|
|
| MANDATORY | NESTED, NEVER, NOT_SUPPORTED, REQUIRES_NEW |
|
|
|
|
| NESTED | NESTED, NEVER, NOT_SUPPORTED, REQUIRES_NEW |
|
|
|
|
| NEVER | MANDATORY, NESTED, REQUIRED, REQUIRES_NEW |
|
|
|
|
| NOT_SUPPORTED | MANDATORY, NESTED, REQUIRED, REQUIRES_NEW |
|
|
|
|
| REQUIRED or ``++@Transactional++`` | NESTED, NEVER, NOT_SUPPORTED, REQUIRES_NEW |
|
|
|
|
| REQUIRES_NEW | NESTED, NEVER, NOT_SUPPORTED, REQUIRES_NEW |
|
|
|
|
| SUPPORTS | MANDATORY, NESTED, NEVER, NOT_SUPPORTED, REQUIRED, REQUIRES_NEW |
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
|
|
@Override
|
|
public void doTheThing() {
|
|
// ...
|
|
actuallyDoTheThing(); // Noncompliant
|
|
}
|
|
|
|
@Override
|
|
@Transactional
|
|
public void actuallyDoTheThing() {
|
|
// ...
|
|
}
|
|
----
|
|
|