2021-04-28 16:49:39 +02:00
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 |
2021-04-28 18:08:03 +02:00
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
@Override
public void doTheThing() {
// ...
actuallyDoTheThing(); // Noncompliant
}
@Override
@Transactional
public void actuallyDoTheThing() {
// ...
}
----
2021-04-28 18:08:03 +02:00
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]