I am trying to create custom annotations for a shortcut, as stated in the documentation:
@Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Transactional("order") public @interface OrderTx { }
However, when I comment on methods with custom annotation, I get an exception:
There is no hibernation session associated with the thread, and the configuration does not allow you to create ...
etc .. Although annotating a method using @Transactional works fine.
Since the method I annotate does not belong to the Bean created from the application context, I assume that AnnotationTransactionAspect does not work with custom annotations, and the AOP magic does not work.
How can I get custom annotations that reduce transactions and work everywhere?
Did I miss something else?
source share