com.jenkov.mrpersister.itf.command
Interface IDaoCommandExecutorUnchecked

All Known Implementing Classes:
DaoCommandExecutorUnchecked

public interface IDaoCommandExecutorUnchecked

A version of the IDaoCommandExecutor that throws unchecked exceptions instead of checked. An IDaoCommandExecutor will be used underneath. All PersistenceExceptions thrown by the IDaoCommandExecutor will be wrapped in an PersistenceExceptionUnchecked instance.


Method Summary
 java.lang.Object execute(IDaoCommand command)
          Obtains a connection from the default data source, executes this dao command and closes the connection afterwards.
 java.lang.Object execute(IDaoCommand command, java.sql.Connection connection)
          Executes this dao command using the given connection, and closes the connection afterwards.
 java.lang.Object execute(java.lang.Object configKey, IDaoCommand command)
          Obtains a connection from the data source set on the IPersistenceConfiguration stored by the given configKey (in the persistence managers config factory), executes this dao command and closes the connection afterwards.
 java.lang.Object execute(java.lang.Object configKey, IDaoCommand command, java.sql.Connection connection)
          Executes this dao command using the given connection and persistence configuration stored by the given config key, and closes the connection afterwards.
 java.lang.Object executeTransaction(IDaoCommand command)
          Obtains a connection from the default data source, sets auto commit to false, executes the dao command and tries to commit the transaction.
 java.lang.Object executeTransaction(IDaoCommand command, java.sql.Connection connection)
          Executes the dao command using the given connection, and tries to commit the transaction.
 java.lang.Object executeTransaction(java.lang.Object config, IDaoCommand command)
          Obtains a connection from the data source set on the IPersistenceConfiguration stored by the given configKey (in the persistence managers config factory), sets auto commit to false, executes the dao command and tries to commit the transaction.
 java.lang.Object executeTransaction(java.lang.Object config, IDaoCommand command, java.sql.Connection connection)
          Executes the dao command using the given connection, and tries to commit the transaction.
 

Method Detail

execute

java.lang.Object execute(IDaoCommand command)
Obtains a connection from the default data source, executes this dao command and closes the connection afterwards.

Parameters:
command - The dao command to execute.
Returns:
The object returned by the IDaoCommand.execute() call.
Throws:
PersistenceExceptionUnchecked - If something goes wrong during execution of the dao command. Fx. if an exception is thrown by the dao command.

execute

java.lang.Object execute(IDaoCommand command,
                         java.sql.Connection connection)
Executes this dao command using the given connection, and closes the connection afterwards.

Parameters:
command - The dao command to execute.
connection - The connection the dao command uses during execution.
Returns:
The object returned by the IDaoCommand.execute() call.
Throws:
PersistenceExceptionUnchecked - If something goes wrong during execution of the dao command. Fx. if an exception is thrown by the dao command.

execute

java.lang.Object execute(java.lang.Object configKey,
                         IDaoCommand command)
Obtains a connection from the data source set on the IPersistenceConfiguration stored by the given configKey (in the persistence managers config factory), executes this dao command and closes the connection afterwards.

Parameters:
configKey - The key of the IPersistenceConfiguration to get the data source from.
command - The dao command to execute.
Returns:
The object returned by the IDaoCommand.execute() call.
Throws:
PersistenceExceptionUnchecked - If something goes wrong during execution of the dao command. Fx. if an exception is thrown by the dao command.

execute

java.lang.Object execute(java.lang.Object configKey,
                         IDaoCommand command,
                         java.sql.Connection connection)
Executes this dao command using the given connection and persistence configuration stored by the given config key, and closes the connection afterwards.

Parameters:
configKey - The key of the IPersistenceConfiguration to get the data source from.
command - The dao command to execute.
connection - The connection the dao command uses during execution.
Returns:
The object returned by the IDaoCommand.execute() call.
Throws:
PersistenceExceptionUnchecked - If something goes wrong during execution of the dao command. Fx. if an exception is thrown by the dao command.

executeTransaction

java.lang.Object executeTransaction(IDaoCommand command)
Obtains a connection from the default data source, sets auto commit to false, executes the dao command and tries to commit the transaction. If an exception is thrown from the dao commands execute() method the transaction will be aborted (rolled back). The connection is closed after commit/rollback.

Parameters:
command -
Returns:
The object returned by the IDaoCommand.execute() call.
Throws:
PersistenceExceptionUnchecked - If something goes wrong during execution of the dao command. Fx. if an exception is thrown by the dao command.

executeTransaction

java.lang.Object executeTransaction(IDaoCommand command,
                                    java.sql.Connection connection)
Executes the dao command using the given connection, and tries to commit the transaction. If an exception is thrown from the dao commands execute() method the transaction will be aborted (rolled back). The connection is closed after commit/rollback.

Parameters:
command - The command to execute.
connection - The connection the dao command uses during execution.
Returns:
The object returned by the IDaoCommand.execute() call.
Throws:
PersistenceExceptionUnchecked - If something goes wrong during execution of the dao command. Fx. if an exception is thrown by the dao command.

executeTransaction

java.lang.Object executeTransaction(java.lang.Object config,
                                    IDaoCommand command)
Obtains a connection from the data source set on the IPersistenceConfiguration stored by the given configKey (in the persistence managers config factory), sets auto commit to false, executes the dao command and tries to commit the transaction. If an exception is thrown from the dao commands execute() method the transaction will be aborted (rolled back). The connection is closed after commit/rollback.

Parameters:
command - The command to execute.
Returns:
The object returned by the IDaoCommand.execute() call.
Throws:
PersistenceExceptionUnchecked - If something goes wrong during execution of the dao command. Fx. if an exception is thrown by the dao command.

executeTransaction

java.lang.Object executeTransaction(java.lang.Object config,
                                    IDaoCommand command,
                                    java.sql.Connection connection)
Executes the dao command using the given connection, and tries to commit the transaction. If an exception is thrown from the dao commands execute() method the transaction will be aborted (rolled back). The connection is closed after commit/rollback.

Parameters:
command - The command to execute.
connection - The connection the dao command uses during execution.
Returns:
The object returned by the IDaoCommand.execute() call.
Throws:
PersistenceExceptionUnchecked - If something goes wrong during execution of the dao command. Fx. if an exception is thrown by the dao command.