Module io.jooby

Annotation Interface Transactional


@Target({TYPE,METHOD}) @Retention(RUNTIME) public @interface Transactional
Useful together with the various route decorators like TransactionalRequest provided by extensions jooby-hibernate, jooby-jdbi or jooby-ebean to toggle it's effect for a single route.

Although TransactionalRequest is configured to be enabled by default, for a route method annotated with @Transactional(false) it won't take effect.

Similarly, if the decorator is disabled by default, a for route method annotated with @Transactional(true) it will take effect.

Use the ATTRIBUTE constant for script routes instead of the annotation itself:


 {
   get("/", ctx -> ...).attribute(Transactional.ATTRIBUTE, true);
 }
 

This annotation has no effect on the behavior of SessionRequest use(s).

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether to enable or disable TransactionalRequest for the annotated route.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Constant to use as attribute name for script routes.
  • Field Details

    • ATTRIBUTE

      static final String ATTRIBUTE
      Constant to use as attribute name for script routes.
      
       {
         get("/", ctx -> ...).attribute(Transactional.ATTRIBUTE, true);
       }
       
  • Element Details

    • value

      boolean value
      Whether to enable or disable TransactionalRequest for the annotated route.
      Returns:
      value to toggle TransactionalRequest
      Default:
      true