org.qi4j.api.unitofwork
Annotation Type UnitOfWorkDiscardOn


@Retention(value=RUNTIME)
@Target(value=METHOD)
@Inherited
@Documented
public @interface UnitOfWorkDiscardOn

Annotation to denote the unit of work discard policy. By default, discard is applied on any method that has UnitOfWorkPropagation and any exception is thrown.

Apply UnitOfWorkDiscardOn to override the default settings.

Usage example:

 
 

@Concerns( UnitOfWorkConcern.class ) public class MyBusinessServiceMixin implements BusinessService { @Structure UnitOfWorkFactory uowf;

@UnitOfWorkDiscardOn( MyBusinessException.class ) public void myBusinessMethod() { // Must invoke current unit of work. UnitOfWork uow = uowf.currentUnitOfWork();

// Perform business logic } }

The unit of work will be discarded iff MyBusinessException exceptions or its subclass is thrown from within myBusinessMethod method.


Optional Element Summary
 Class<? extends Throwable>[] value
           
 

value

public abstract Class<? extends Throwable>[] value
Default:
java.lang.Throwable.class