58 lines
1.4 KiB
Plaintext
58 lines
1.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
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:
|
|
|
|
[frame=all]
|
|
[cols="^1,^1"]
|
|
|===
|
|
|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
|
|
|
|
[source,java]
|
|
----
|
|
|
|
@Override
|
|
public void doTheThing() {
|
|
// ...
|
|
actuallyDoTheThing(); // Noncompliant
|
|
}
|
|
|
|
@Override
|
|
@Transactional
|
|
public void actuallyDoTheThing() {
|
|
// ...
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
include::highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|