org.qi4j.api.unitofwork
Annotation Type UnitOfWorkDiscardOn
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 |
java.lang.Class<? extends java.lang.Throwable>[] |
value
|
value
public abstract java.lang.Class<? extends java.lang.Throwable>[] value
- Default:
- java.lang.Throwable.class
Copyright © 2007-2010. All Rights Reserved.