org.qi4j.api.unitofwork
Interface UnitOfWorkFactory


public interface UnitOfWorkFactory

Factory for UnitOfWork.


Method Summary
 UnitOfWork currentUnitOfWork()
          Returns the UnitOfWork that is currently associated with the executing thread.
 UnitOfWork getUnitOfWork(EntityComposite entity)
          Returns the UnitOfWork that the EntityComposite is bound to.
 UnitOfWork newUnitOfWork()
          Create a new UnitOfWork and associate it with the current thread.
 UnitOfWork newUnitOfWork(Usecase usecase)
          Create a new UnitOfWork for the given Usecase and associate it with the current thread.
 

Method Detail

newUnitOfWork

UnitOfWork newUnitOfWork()
Create a new UnitOfWork and associate it with the current thread.

The UnitOfWork will use the default Usecase settings.

Returns:
a new UnitOfWork

newUnitOfWork

UnitOfWork newUnitOfWork(Usecase usecase)
Create a new UnitOfWork for the given Usecase and associate it with the current thread.

Parameters:
usecase - the Usecase for this UnitOfWork
Returns:
a new UnitOfWork

currentUnitOfWork

UnitOfWork currentUnitOfWork()
Returns the UnitOfWork that is currently associated with the executing thread.

Returns:
The current UnitOfWork associated with the executing thread, or null if there is no current UnitOfWork.

getUnitOfWork

UnitOfWork getUnitOfWork(EntityComposite entity)
Returns the UnitOfWork that the EntityComposite is bound to.

Parameters:
entity - the entity to be checked.
Returns:
The UnitOfWork instance that the Entity is bound to, or null if the entity is not associated with any UnitOfWork.