snowdrop-zen / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
1 stars 0 forks source link

Quarkus instrumentation warns about use of @Transactional on private methods #447

Closed snowdrop-bot closed 3 years ago

snowdrop-bot commented 3 years ago

Description

The @Transactional annotation does not work, if it's annotated on a private method:

@Transactional
private void doSomething() {
  A a = new A();
  a.persist();
}

Because the method is private the entity will not be persisted.

Even though I know about the rule, it does happen that the private sneaks in...

Would it be possible for Quarkus to detect this situation and warn the user? There are already warning about split packages and other potential problems...

Implementation ideas

Warn the user about the usage of private and @Transactional - maybe even error and fail the build.


https://github.com/quarkusio/quarkus/issues/21046


$upstream:21046$