com.ibatis.dao.engine.impl
Class StandardDaoManager

java.lang.Object
  extended bycom.ibatis.dao.engine.impl.StandardDaoManager
All Implemented Interfaces:
DaoManager

public class StandardDaoManager
extends java.lang.Object
implements DaoManager


Constructor Summary
StandardDaoManager()
           
 
Method Summary
 void addContext(DaoContext context)
           
 void addContextInTransaction(DaoContext ctx)
           
 void commitTransaction()
          Commits all transactions currently started for all DAO contexts managed by this DaoManager.
 void endTransaction()
          Ends all transactions currently started for all DAO contexts managed by this DaoManager.
 Dao getDao(java.lang.Class iface)
          Gets a Dao instance for the requested interface type.
 Dao getDao(java.lang.Class iface, java.lang.String contextId)
          Gets a Dao instance for the requested interface type registered under the context with the specified id.
 DaoTransaction getTransaction(Dao dao)
          Gets the transaction that the provided Dao is currently working under.
 boolean isExplicitTransaction()
           
 void startTransaction()
          Starts a transaction scope managed by this DaoManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardDaoManager

public StandardDaoManager()
Method Detail

addContext

public void addContext(DaoContext context)

getDao

public Dao getDao(java.lang.Class iface)
Description copied from interface: DaoManager
Gets a Dao instance for the requested interface type.

Specified by:
getDao in interface DaoManager
Parameters:
iface - The interface or generic type for which an implementation should be returned.
Returns:
The Dao implementation instance.

getDao

public Dao getDao(java.lang.Class iface,
                  java.lang.String contextId)
Description copied from interface: DaoManager
Gets a Dao instance for the requested interface type registered under the context with the specified id.

Specified by:
getDao in interface DaoManager
Parameters:
iface - The interface or generic type for which an implementation should be returned.
contextId - The ID of the context under which to find the DAO implementation (use for multiple interface defs).
Returns:
The Dao implementation instance.

startTransaction

public void startTransaction()
Description copied from interface: DaoManager
Starts a transaction scope managed by this DaoManager. If this method isn't called, then all DAO methods use "autocommit" semantics.

Specified by:
startTransaction in interface DaoManager

commitTransaction

public void commitTransaction()
Description copied from interface: DaoManager
Commits all transactions currently started for all DAO contexts managed by this DaoManager.

Specified by:
commitTransaction in interface DaoManager

endTransaction

public void endTransaction()
Description copied from interface: DaoManager
Ends all transactions currently started for all DAO contexts managed by this DaoManager. If any transactions have not been successfully committed, then those remaining will be rolled back.

Specified by:
endTransaction in interface DaoManager

getTransaction

public DaoTransaction getTransaction(Dao dao)
Description copied from interface: DaoManager
Gets the transaction that the provided Dao is currently working under. If there is no current transaction in scope, one will be started.

Specified by:
getTransaction in interface DaoManager
Parameters:
dao - The Dao to find a transaction for.
Returns:
The Transaction under which the Dao provided is working under.

isExplicitTransaction

public boolean isExplicitTransaction()

addContextInTransaction

public void addContextInTransaction(DaoContext ctx)