org.apache.onami.persist
Annotation Type Transactional


@Target(value={METHOD,TYPE})
@Retention(value=RUNTIME)
@Inherited
public @interface Transactional

Marks a method or class to be executed within a transaction.

This will span a new transaction around the method unless there is already a running transaction. In the case that there is a running transaction no new transaction is started. If a rollback happens for a method which did not start the transaction the already existing transaction will be marked as rollbackOnly.

Guice uses AOP to enhance a method annotated with @Transactional with a wrapper. This means the @Transactional only works as expected when:


Optional Element Summary
 Class<? extends Exception>[] ignore
          A list of exceptions to not rollback on.
 Class<? extends Annotation>[] onUnits
          A List of annotations for persistence units on which to start a transaction.
 Class<? extends Exception>[] rollbackOn
          A list of exceptions to rollback on.
 

onUnits

public abstract Class<? extends Annotation>[] onUnits
A List of annotations for persistence units on which to start a transaction. Default is on all persistence units.

Default:
{}

rollbackOn

public abstract Class<? extends Exception>[] rollbackOn
A list of exceptions to rollback on. Default is RuntimeException.

Default:
java.lang.RuntimeException.class

ignore

public abstract Class<? extends Exception>[] ignore
A list of exceptions to not rollback on. Use this to exclude one ore more subclasses of the exceptions defined in rollbackOn(). Default is none.

Default:
{}


Copyright © 2013–2014 The Apache Software Foundation. All rights reserved.