Annotation Interface ContainerTransactional


@Retention(RUNTIME) @Target(METHOD) public @interface ContainerTransactional
Describe a method as transactional. This annotation will allow to: - Set current container to PortalContainer - Start the request lifecycle of the container: the IDM session transaction and the JPA EntityManager. The JPA writes made through kernel DAOs commit one DAO call at a time, unless atomic() is set. This annotation is handled in io.meeds.common.ContainerTransactionalAspect.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
     
  • Element Details

    • atomic

      boolean atomic
      Returns:
      true to run the method in one JPA transaction, committed when it returns and rolled back when it throws. The writes made through the kernel EntityManager (kernel DAOs, ExoTransactional methods) join it. When the method begins the transaction, the Spring transactional methods, Spring Data repositories included, join it too, unless a Spring transaction of its own is active on the thread, and the callbacks they register run once it is committed or rolled back, unless a Spring transaction synchronization is already active on the thread: their callbacks are then left to that synchronization. A Spring cache eviction (CacheEvict) made inside the method takes effect at once, before the commit. When a call that failed marked the transaction rollback-only, a method that returned throws a RollbackException after the rollback, and a method that threw keeps its exception, unless the rollback fails. When a JPA transaction is already active on the thread, the method joins it and marks it rollback-only when it throws.
      Default:
      false