com.ibatis.sqlmap.engine.impl
Interface ExtendedSqlMapClient

All Superinterfaces:
SqlMapClient, SqlMapExecutor, SqlMapTransactionManager
All Known Implementing Classes:
SqlMapClientImpl

Deprecated. - this class is uneccessary and should be removed as soon as possible. Currently spring integration depends on it.

public interface ExtendedSqlMapClient
extends SqlMapClient


Method Summary
 void commitTransaction()
          Deprecated. Commits the currently started transaction.
 int delete(String id)
          Deprecated. Executes a mapped SQL DELETE statement.
 int delete(String id, Object param)
          Deprecated. Executes a mapped SQL DELETE statement.
 void endTransaction()
          Deprecated. Ends a transaction and rolls back if necessary.
 int executeBatch()
          Deprecated. Executes (flushes) all statements currently batched.
 List executeBatchDetailed()
          Deprecated. Executes (flushes) all statements currently batched.
 void flushDataCache()
          Deprecated. Flushes all data caches.
 void flushDataCache(String cacheId)
          Deprecated. Flushes the data cache that matches the cache model ID provided.
 Connection getCurrentConnection()
          Deprecated. Returns the current connection in use.
 DataSource getDataSource()
          Deprecated. Returns the DataSource instance currently being used by the SqlMapSession.
 SqlMapExecutorDelegate getDelegate()
          Deprecated.  
 MappedStatement getMappedStatement(String id)
          Deprecated.  
 ResultObjectFactory getResultObjectFactory()
          Deprecated.  
 SqlMapSession getSession()
          Deprecated. TODO : Deprecated and will be removed.
 SqlExecutor getSqlExecutor()
          Deprecated.  
 Connection getUserConnection()
          Deprecated. Returns the current user supplied connection as set by setUserConnection().
 Object insert(String id)
          Deprecated. Executes a mapped SQL INSERT statement.
 Object insert(String id, Object param)
          Deprecated. Executes a mapped SQL INSERT statement.
 boolean isEnhancementEnabled()
          Deprecated.  
 boolean isLazyLoadingEnabled()
          Deprecated.  
 SqlMapSession openSession()
          Deprecated. Returns a single threaded SqlMapSession implementation for use by one user.
 SqlMapSession openSession(Connection conn)
          Deprecated. Returns a single threaded SqlMapSession implementation for use by one user.
 List queryForList(String id)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a number of result objects.
 List queryForList(String id, int skip, int max)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.
 List queryForList(String id, Object paramObject)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a number of result objects.
 List queryForList(String id, Object paramObject, int skip, int max)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.
 Map queryForMap(String id, Object paramObject, String keyProp)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a number of result objects that will be keyed into a Map.
 Map queryForMap(String id, Object paramObject, String keyProp, String valueProp)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a number of result objects from which one property will be keyed into a Map.
 Object queryForObject(String id)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a single object instance.
 Object queryForObject(String id, Object paramObject)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a single object instance.
 Object queryForObject(String id, Object paramObject, Object resultObject)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate the supplied result object.
 PaginatedList queryForPaginatedList(String id, int pageSize)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a number of result objects a page at a time.
 PaginatedList queryForPaginatedList(String id, Object paramObject, int pageSize)
          Deprecated. Executes a mapped SQL SELECT statement that returns data to populate a number of result objects a page at a time.
 void queryWithRowHandler(String id, Object paramObject, RowHandler rowHandler)
          Deprecated. Executes a mapped SQL SELECT statement that returns a number of result objects that will be handled one at a time by a RowHandler.
 void queryWithRowHandler(String id, RowHandler rowHandler)
          Deprecated. Executes a mapped SQL SELECT statement that returns a number of result objects that will be handled one at a time by a RowHandler.
 void setUserConnection(Connection connection)
          Deprecated. Allows the developer to easily use an externally supplied connection when executing statements.
 void startBatch()
          Deprecated. Starts a batch in which update statements will be cached before being sent to the database all at once.
 void startTransaction()
          Deprecated. Demarcates the beginning of a transaction scope.
 void startTransaction(int transactionIsolation)
          Deprecated. Demarcates the beginning of a transaction scope using the specified transaction isolation.
 int update(String id)
          Deprecated. Executes a mapped SQL UPDATE statement.
 int update(String id, Object param)
          Deprecated. Executes a mapped SQL UPDATE statement.
 

Method Detail

insert

Object insert(String id,
              Object param)
              throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL INSERT statement. Insert is a bit different from other update methods, as it provides facilities for returning the primary key of the newly inserted row (rather than the effected rows). This functionality is of course optional.

The parameter object is generally used to supply the input data for the INSERT values.

Specified by:
insert in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
param - The parameter object (e.g. JavaBean, Map, XML etc.).
Returns:
The primary key of the newly inserted row. This might be automatically generated by the RDBMS, or selected from a sequence table or other source.
Throws:
SQLException - If an error occurs.

insert

Object insert(String id)
              throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL INSERT statement. Insert is a bit different from other update methods, as it provides facilities for returning the primary key of the newly inserted row (rather than the effected rows). This functionality is of course optional.

This overload assumes no parameter is needed.

Specified by:
insert in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
Returns:
The primary key of the newly inserted row. This might be automatically generated by the RDBMS, or selected from a sequence table or other source.
Throws:
SQLException - If an error occurs.

update

int update(String id,
           Object param)
           throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL UPDATE statement. Update can also be used for any other update statement type, such as inserts and deletes. Update returns the number of rows effected.

The parameter object is generally used to supply the input data for the UPDATE values as well as the WHERE clause parameter(s).

Specified by:
update in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
param - The parameter object (e.g. JavaBean, Map, XML etc.).
Returns:
The number of rows effected.
Throws:
SQLException - If an error occurs.

update

int update(String id)
           throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL UPDATE statement. Update can also be used for any other update statement type, such as inserts and deletes. Update returns the number of rows effected.

This overload assumes no parameter is needed.

Specified by:
update in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
Returns:
The number of rows effected.
Throws:
SQLException - If an error occurs.

delete

int delete(String id,
           Object param)
           throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL DELETE statement. Delete returns the number of rows effected.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the DELETE statement.

Specified by:
delete in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
param - The parameter object (e.g. JavaBean, Map, XML etc.).
Returns:
The number of rows effected.
Throws:
SQLException - If an error occurs.

delete

int delete(String id)
           throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL DELETE statement. Delete returns the number of rows effected.

This overload assumes no parameter is needed.

Specified by:
delete in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
Returns:
The number of rows effected.
Throws:
SQLException - If an error occurs.

queryForObject

Object queryForObject(String id,
                      Object paramObject)
                      throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a single object instance.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Specified by:
queryForObject in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
paramObject - The parameter object (e.g. JavaBean, Map, XML etc.).
Returns:
The single result object populated with the result set data, or null if no result was found
Throws:
SQLException - If more than one result was found, or if any other error occurs.

queryForObject

Object queryForObject(String id)
                      throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a single object instance.

This overload assumes no parameter is needed.

Specified by:
queryForObject in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
Returns:
The single result object populated with the result set data, or null if no result was found
Throws:
SQLException - If more than one result was found, or if any other error occurs.

queryForObject

Object queryForObject(String id,
                      Object paramObject,
                      Object resultObject)
                      throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate the supplied result object.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Specified by:
queryForObject in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
paramObject - The parameter object (e.g. JavaBean, Map, XML etc.).
resultObject - The result object instance that should be populated with result data.
Returns:
The single result object as supplied by the resultObject parameter, populated with the result set data, or null if no result was found
Throws:
SQLException - If more than one result was found, or if any other error occurs.

queryForList

List queryForList(String id,
                  Object paramObject)
                  throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Specified by:
queryForList in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
paramObject - The parameter object (e.g. JavaBean, Map, XML etc.).
Returns:
A List of result objects.
Throws:
SQLException - If an error occurs.

queryForList

List queryForList(String id)
                  throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects.

This overload assumes no parameter is needed.

Specified by:
queryForList in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
Returns:
A List of result objects.
Throws:
SQLException - If an error occurs.

queryForList

List queryForList(String id,
                  Object paramObject,
                  int skip,
                  int max)
                  throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Specified by:
queryForList in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
paramObject - The parameter object (e.g. JavaBean, Map, XML etc.).
skip - The number of results to ignore.
max - The maximum number of results to return.
Returns:
A List of result objects.
Throws:
SQLException - If an error occurs.

queryForList

List queryForList(String id,
                  int skip,
                  int max)
                  throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range.

This overload assumes no parameter is needed.

Specified by:
queryForList in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
skip - The number of results to ignore.
max - The maximum number of results to return.
Returns:
A List of result objects.
Throws:
SQLException - If an error occurs.

queryForPaginatedList

PaginatedList queryForPaginatedList(String id,
                                    Object paramObject,
                                    int pageSize)
                                    throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects a page at a time.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Specified by:
queryForPaginatedList in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
paramObject - The parameter object (e.g. JavaBean, Map, XML etc.).
pageSize - The maximum number of result objects each page can hold.
Returns:
A PaginatedList of result objects.
Throws:
SQLException - If an error occurs.

queryForPaginatedList

PaginatedList queryForPaginatedList(String id,
                                    int pageSize)
                                    throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects a page at a time.

This overload assumes no parameter is needed.

Specified by:
queryForPaginatedList in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
pageSize - The maximum number of result objects each page can hold.
Returns:
A PaginatedList of result objects.
Throws:
SQLException - If an error occurs.

queryForMap

Map queryForMap(String id,
                Object paramObject,
                String keyProp)
                throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects that will be keyed into a Map.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Specified by:
queryForMap in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
paramObject - The parameter object (e.g. JavaBean, Map, XML etc.).
keyProp - The property to be used as the key in the Map.
Returns:
A Map keyed by keyProp with values being the result object instance.
Throws:
SQLException - If an error occurs.

queryForMap

Map queryForMap(String id,
                Object paramObject,
                String keyProp,
                String valueProp)
                throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects from which one property will be keyed into a Map.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Specified by:
queryForMap in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
paramObject - The parameter object (e.g. JavaBean, Map, XML etc.).
keyProp - The property to be used as the key in the Map.
valueProp - The property to be used as the value in the Map.
Returns:
A Map keyed by keyProp with values of valueProp.
Throws:
SQLException - If an error occurs.

queryWithRowHandler

void queryWithRowHandler(String id,
                         Object paramObject,
                         RowHandler rowHandler)
                         throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns a number of result objects that will be handled one at a time by a RowHandler.

This is generally a good approach to take when dealing with large sets of records (i.e. hundreds, thousands...) that need to be processed without eating up all of the system resources.

The parameter object is generally used to supply the input data for the WHERE clause parameter(s) of the SELECT statement.

Specified by:
queryWithRowHandler in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
paramObject - The parameter object (e.g. JavaBean, Map, XML etc.).
rowHandler - A RowHandler instance
Throws:
SQLException - If an error occurs.

queryWithRowHandler

void queryWithRowHandler(String id,
                         RowHandler rowHandler)
                         throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes a mapped SQL SELECT statement that returns a number of result objects that will be handled one at a time by a RowHandler.

This is generally a good approach to take when dealing with large sets of records (i.e. hundreds, thousands...) that need to be processed without eating up all of the system resources.

This overload assumes no parameter is needed.

Specified by:
queryWithRowHandler in interface SqlMapExecutor
Parameters:
id - The name of the statement to execute.
rowHandler - A RowHandler instance
Throws:
SQLException - If an error occurs.

startTransaction

void startTransaction()
                      throws SQLException
Deprecated. 
Description copied from interface: SqlMapTransactionManager
Demarcates the beginning of a transaction scope. Transactions must be properly committed or rolled back to be effective. Use the following pattern when working with transactions:
 try {
   sqlMap.startTransaction();
   // do work
   sqlMap.commitTransaction();
 } finally {
   sqlMap.endTransaction();
 }
 

Always call endTransaction() once startTransaction() has been called.

Specified by:
startTransaction in interface SqlMapTransactionManager
Throws:
SQLException - If an error occurs while starting the transaction, or the transaction could not be started.

startTransaction

void startTransaction(int transactionIsolation)
                      throws SQLException
Deprecated. 
Description copied from interface: SqlMapTransactionManager
Demarcates the beginning of a transaction scope using the specified transaction isolation. Transactions must be properly committed or rolled back to be effective. Use the following pattern when working with transactions:
 try {
   sqlMap.startTransaction(Connection.TRANSACTION_REPEATABLE_READ);
   // do work
   sqlMap.commitTransaction();
 } finally {
   sqlMap.endTransaction();
 }
 

Always call endTransaction() once startTransaction() has been called.

Specified by:
startTransaction in interface SqlMapTransactionManager
Throws:
SQLException - If an error occurs while starting the transaction, or the transaction could not be started.

commitTransaction

void commitTransaction()
                       throws SQLException
Deprecated. 
Description copied from interface: SqlMapTransactionManager
Commits the currently started transaction.

Specified by:
commitTransaction in interface SqlMapTransactionManager
Throws:
SQLException - If an error occurs while committing the transaction, or the transaction could not be committed.

endTransaction

void endTransaction()
                    throws SQLException
Deprecated. 
Description copied from interface: SqlMapTransactionManager
Ends a transaction and rolls back if necessary. If the transaction has been started, but not committed, it will be rolled back upon calling endTransaction().

Specified by:
endTransaction in interface SqlMapTransactionManager
Throws:
SQLException - If an error occurs during rollback or the transaction could not be ended.

startBatch

void startBatch()
                throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Starts a batch in which update statements will be cached before being sent to the database all at once. This can improve overall performance of updates update when dealing with numerous updates (e.g. inserting 1:M related data).

Specified by:
startBatch in interface SqlMapExecutor
Throws:
SQLException - If the batch could not be started.

executeBatch

int executeBatch()
                 throws SQLException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes (flushes) all statements currently batched.

Specified by:
executeBatch in interface SqlMapExecutor
Returns:
the number of rows updated in the batch
Throws:
SQLException - If the batch could not be executed or if any of the statements fails.

executeBatchDetailed

List executeBatchDetailed()
                          throws SQLException,
                                 BatchException
Deprecated. 
Description copied from interface: SqlMapExecutor
Executes (flushes) all statements currently batched.

Specified by:
executeBatchDetailed in interface SqlMapExecutor
Returns:
a List of BatchResult objects. There will be one element in the list for each sub-batch executed. A sub-batch is created by adding a statement to the batch that does not equal the prior statement.
Throws:
SQLException - if a database access error occurs, or the drive does not support batch statements
BatchException - if the driver throws BatchUpdateException
See Also:
BatchException

setUserConnection

void setUserConnection(Connection connection)
                       throws SQLException
Deprecated. 
Description copied from interface: SqlMapTransactionManager
Allows the developer to easily use an externally supplied connection when executing statements.

Important: Using a user supplied connection basically sidesteps the transaction manager, so you are responsible for appropriately. Here's a (very) simple example (throws SQLException):

 try {
   Connection connection = dataSource.getConnection();
   sqlMap.setUserConnection(connection);
   // do work
   connection.commit();
 } catch (SQLException e) {
     try {
       if (connection != null) commit.rollback();
     } catch (SQLException ignored) {
       // generally ignored
     }
     throw e;  // rethrow the exception
 } finally {
   try {
     if (connection != null) connection.close();
   } catch (SQLException ignored) {
     // generally ignored
   }
 }
 

Specified by:
setUserConnection in interface SqlMapTransactionManager
Throws:
SQLException

getUserConnection

Connection getUserConnection()
                             throws SQLException
Deprecated. 
Description copied from interface: SqlMapTransactionManager
Returns the current user supplied connection as set by setUserConnection().

TODO : DEPRECATED

Specified by:
getUserConnection in interface SqlMapTransactionManager
Returns:
The current user supplied connection.
Throws:
SQLException

getCurrentConnection

Connection getCurrentConnection()
                                throws SQLException
Deprecated. 
Description copied from interface: SqlMapTransactionManager
Returns the current connection in use. If no connection exists null will be returned. There may be no connection if no transaction has been started, and if no user provided connection has been set.

Specified by:
getCurrentConnection in interface SqlMapTransactionManager
Returns:
The current connection or null.
Throws:
SQLException

getDataSource

DataSource getDataSource()
Deprecated. 
Description copied from interface: SqlMapTransactionManager
Returns the DataSource instance currently being used by the SqlMapSession.

Specified by:
getDataSource in interface SqlMapTransactionManager
Returns:
The DataSource instance currently being used by the SqlMapSession.

getMappedStatement

MappedStatement getMappedStatement(String id)
Deprecated. 

isLazyLoadingEnabled

boolean isLazyLoadingEnabled()
Deprecated. 

isEnhancementEnabled

boolean isEnhancementEnabled()
Deprecated. 

getSqlExecutor

SqlExecutor getSqlExecutor()
Deprecated. 

getDelegate

SqlMapExecutorDelegate getDelegate()
Deprecated. 

openSession

SqlMapSession openSession()
Deprecated. 
Description copied from interface: SqlMapClient
Returns a single threaded SqlMapSession implementation for use by one user. Remember though, that SqlMapClient itself is a thread safe SqlMapSession implementation, so you can also just work directly with it. If you do get a session explicitly using this method be sure to close it! You can close a session using the sqlMapSession.close() method.

Specified by:
openSession in interface SqlMapClient
Returns:
An SqlMapSession instance.

openSession

SqlMapSession openSession(Connection conn)
Deprecated. 
Description copied from interface: SqlMapClient
Returns a single threaded SqlMapSession implementation for use by one user. Remember though, that SqlMapClient itself is a thread safe SqlMapSession implementation, so you can also just work directly with it. If you do get a session explicitly using this method be sure to close it! You can close a session using the SqlMapSession.close() method.

This particular implementation takes a user provided connection as a parameter. This connection will be used for executing statements, and therefore overrides any configured datasources. Using this approach allows the developer to easily use an externally supplied connection for executing statements.

Important: Using a user supplied connection basically sidesteps the datasource so you are responsible for appropriately handling your connection lifecycle (i.e. closing). Here's a (very) simple example (throws SQLException):

 try {
   Connection connection = dataSource.getConnection();
   SqlMapSession session = sqlMap.openSession(connection);
   // do work
   connection.commit();
 } catch (SQLException e) {
     try {
       if (connection != null) commit.rollback();
     } catch (SQLException ignored) {
       // generally ignored
     }
     throw e;  // rethrow the exception
 } finally {
   try {
     if (connection != null) connection.close();
   } catch (SQLException ignored) {
     // generally ignored
   }
 }
 

Specified by:
openSession in interface SqlMapClient
Parameters:
conn - - the connection to use for the session
Returns:
An SqlMapSession instance.

getSession

SqlMapSession getSession()
Deprecated. 
Description copied from interface: SqlMapClient
TODO : Deprecated and will be removed.

Specified by:
getSession in interface SqlMapClient
Returns:
A session (DEPRECATED)

flushDataCache

void flushDataCache()
Deprecated. 
Description copied from interface: SqlMapClient
Flushes all data caches.

Specified by:
flushDataCache in interface SqlMapClient

flushDataCache

void flushDataCache(String cacheId)
Deprecated. 
Description copied from interface: SqlMapClient
Flushes the data cache that matches the cache model ID provided. cacheId should include the namespace, even when useStatementNamespaces="false".

Specified by:
flushDataCache in interface SqlMapClient
Parameters:
cacheId - The cache model to flush

getResultObjectFactory

ResultObjectFactory getResultObjectFactory()
Deprecated. 


Copyright © 2010. All Rights Reserved.