We have base generic manager which is inherited by all managers. Base manager is annotated with @Transactional annotations.
There are 2 groups of t
I guess you can define @Transactional
at class-level
@Service
@Transactional(readOnly = false, value="txManager2")
class BillingManagerImpl ....
There is the possibility to create your own annotations as shortcuts for @Transactional(value="tx1")
. (These can be used at class or method level)
from the reference documentation:
For example, defining the following annotations
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Transactional("order")
public @interface OrderTx {
}
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Transactional("account")
public @interface AccountTx {
}
allows us to write the example from the previous section as
public class TransactionalService {
@OrderTx
public void setSomething(String name) { ... }
@AccountTx
public void doSomething() { ... }
}