|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |
java.lang.Objectcom.ibatis.sqlmap.engine.impl.SqlMapClientImpl
public class SqlMapClientImpl
Implementation of ExtendedSqlMapClient
字段摘要 | |
---|---|
SqlMapExecutorDelegate |
delegate
Delegate for SQL execution |
protected java.lang.ThreadLocal |
localSqlMapSession
|
构造器摘要 | |
---|---|
SqlMapClientImpl(SqlMapExecutorDelegate delegate)
Constructor to supply a delegate |
方法摘要 | |
---|---|
void |
commitTransaction()
Commits the currently started transaction. |
int |
delete(java.lang.String id)
Executes a mapped SQL DELETE statement. |
int |
delete(java.lang.String id,
java.lang.Object param)
Executes a mapped SQL DELETE statement. |
void |
endTransaction()
Ends a transaction and rolls back if necessary. |
int |
executeBatch()
Executes (flushes) all statements currently batched. |
java.util.List |
executeBatchDetailed()
Executes (flushes) all statements currently batched. |
void |
flushDataCache()
Flushes all data caches. |
void |
flushDataCache(java.lang.String cacheId)
Flushes the data cache that matches the cache model ID provided. |
java.sql.Connection |
getCurrentConnection()
Returns the current connection in use. |
javax.sql.DataSource |
getDataSource()
Returns the DataSource instance currently being used by the SqlMapSession. |
SqlMapExecutorDelegate |
getDelegate()
|
protected SqlMapSessionImpl |
getLocalSqlMapSession()
|
MappedStatement |
getMappedStatement(java.lang.String id)
|
ResultObjectFactory |
getResultObjectFactory()
|
SqlMapSession |
getSession()
Deprecated. Use openSession() |
SqlExecutor |
getSqlExecutor()
|
java.sql.Connection |
getUserConnection()
Deprecated. |
java.lang.Object |
insert(java.lang.String id)
Executes a mapped SQL INSERT statement. |
java.lang.Object |
insert(java.lang.String id,
java.lang.Object param)
Executes a mapped SQL INSERT statement. |
boolean |
isEnhancementEnabled()
|
boolean |
isLazyLoadingEnabled()
|
SqlMapSession |
openSession()
Returns a single threaded SqlMapSession implementation for use by one user. |
SqlMapSession |
openSession(java.sql.Connection conn)
Returns a single threaded SqlMapSession implementation for use by one user. |
java.util.List |
queryForList(java.lang.String id)
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects. |
java.util.List |
queryForList(java.lang.String id,
int skip,
int max)
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range. |
java.util.List |
queryForList(java.lang.String id,
java.lang.Object paramObject)
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects. |
java.util.List |
queryForList(java.lang.String id,
java.lang.Object paramObject,
int skip,
int max)
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects within a certain range. |
java.util.Map |
queryForMap(java.lang.String id,
java.lang.Object paramObject,
java.lang.String keyProp)
Executes a mapped SQL SELECT statement that returns data to populate a number of result objects that will be keyed into a Map. |
java.util.Map |
queryForMap(java.lang.String id,
java.lang.Object paramObject,
java.lang.String keyProp,
java.lang.String valueProp)
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. |
java.lang.Object |
queryForObject(java.lang.String id)
Executes a mapped SQL SELECT statement that returns data to populate a single object instance. |
java.lang.Object |
queryForObject(java.lang.String id,
java.lang.Object paramObject)
Executes a mapped SQL SELECT statement that returns data to populate a single object instance. |
java.lang.Object |
queryForObject(java.lang.String id,
java.lang.Object paramObject,
java.lang.Object resultObject)
Executes a mapped SQL SELECT statement that returns data to populate the supplied result object. |
PaginatedList |
queryForPaginatedList(java.lang.String id,
int pageSize)
Deprecated. All paginated list features have been deprecated |
PaginatedList |
queryForPaginatedList(java.lang.String id,
java.lang.Object paramObject,
int pageSize)
Deprecated. All paginated list features have been deprecated |
void |
queryWithRowHandler(java.lang.String id,
java.lang.Object paramObject,
RowHandler rowHandler)
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(java.lang.String id,
RowHandler rowHandler)
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(java.sql.Connection connection)
Allows the developer to easily use an externally supplied connection when executing statements. |
void |
startBatch()
Starts a batch in which update statements will be cached before being sent to the database all at once. |
void |
startTransaction()
Demarcates the beginning of a transaction scope. |
void |
startTransaction(int transactionIsolation)
Demarcates the beginning of a transaction scope using the specified transaction isolation. |
int |
update(java.lang.String id)
Executes a mapped SQL UPDATE statement. |
int |
update(java.lang.String id,
java.lang.Object param)
Executes a mapped SQL UPDATE statement. |
类方法继承: java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段详细信息 |
---|
public SqlMapExecutorDelegate delegate
protected java.lang.ThreadLocal localSqlMapSession
构造器详细信息 |
---|
public SqlMapClientImpl(SqlMapExecutorDelegate delegate)
delegate
- - the delegate方法详细信息 |
---|
public java.lang.Object insert(java.lang.String id, java.lang.Object param) throws java.sql.SQLException
SqlMapExecutor
insert
in interface SqlMapExecutor
insert
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.param
- The parameter object (e.g. JavaBean, Map, XML etc.).
java.sql.SQLException
- If an error occurs.public java.lang.Object insert(java.lang.String id) throws java.sql.SQLException
SqlMapExecutor
insert
in interface SqlMapExecutor
insert
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.
java.sql.SQLException
- If an error occurs.public int update(java.lang.String id, java.lang.Object param) throws java.sql.SQLException
SqlMapExecutor
update
in interface SqlMapExecutor
update
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.param
- The parameter object (e.g. JavaBean, Map, XML etc.).
java.sql.SQLException
- If an error occurs.public int update(java.lang.String id) throws java.sql.SQLException
SqlMapExecutor
update
in interface SqlMapExecutor
update
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.
java.sql.SQLException
- If an error occurs.public int delete(java.lang.String id, java.lang.Object param) throws java.sql.SQLException
SqlMapExecutor
delete
in interface SqlMapExecutor
delete
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.param
- The parameter object (e.g. JavaBean, Map, XML etc.).
java.sql.SQLException
- If an error occurs.public int delete(java.lang.String id) throws java.sql.SQLException
SqlMapExecutor
delete
in interface SqlMapExecutor
delete
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.
java.sql.SQLException
- If an error occurs.public java.lang.Object queryForObject(java.lang.String id, java.lang.Object paramObject) throws java.sql.SQLException
SqlMapExecutor
queryForObject
in interface SqlMapExecutor
queryForObject
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.paramObject
- The parameter object (e.g. JavaBean, Map, XML etc.).
java.sql.SQLException
- If more than one result was found, or if any other error occurs.public java.lang.Object queryForObject(java.lang.String id) throws java.sql.SQLException
SqlMapExecutor
queryForObject
in interface SqlMapExecutor
queryForObject
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.
java.sql.SQLException
- If more than one result was found, or if any other error occurs.public java.lang.Object queryForObject(java.lang.String id, java.lang.Object paramObject, java.lang.Object resultObject) throws java.sql.SQLException
SqlMapExecutor
queryForObject
in interface SqlMapExecutor
queryForObject
in interface ExtendedSqlMapClient
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.
java.sql.SQLException
- If more than one result was found, or if any other error occurs.public java.util.List queryForList(java.lang.String id, java.lang.Object paramObject) throws java.sql.SQLException
SqlMapExecutor
queryForList
in interface SqlMapExecutor
queryForList
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.paramObject
- The parameter object (e.g. JavaBean, Map, XML etc.).
java.sql.SQLException
- If an error occurs.public java.util.List queryForList(java.lang.String id) throws java.sql.SQLException
SqlMapExecutor
queryForList
in interface SqlMapExecutor
queryForList
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.
java.sql.SQLException
- If an error occurs.public java.util.List queryForList(java.lang.String id, java.lang.Object paramObject, int skip, int max) throws java.sql.SQLException
SqlMapExecutor
queryForList
in interface SqlMapExecutor
queryForList
in interface ExtendedSqlMapClient
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.
java.sql.SQLException
- If an error occurs.public java.util.List queryForList(java.lang.String id, int skip, int max) throws java.sql.SQLException
SqlMapExecutor
queryForList
in interface SqlMapExecutor
queryForList
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.skip
- The number of results to ignore.max
- The maximum number of results to return.
java.sql.SQLException
- If an error occurs.public PaginatedList queryForPaginatedList(java.lang.String id, java.lang.Object paramObject, int pageSize) throws java.sql.SQLException
SqlMapExecutor
queryForPaginatedList
in interface SqlMapExecutor
queryForPaginatedList
in interface ExtendedSqlMapClient
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.
java.sql.SQLException
- If an error occurs.public PaginatedList queryForPaginatedList(java.lang.String id, int pageSize) throws java.sql.SQLException
SqlMapExecutor
queryForPaginatedList
in interface SqlMapExecutor
queryForPaginatedList
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.pageSize
- The maximum number of result objects each page can hold.
java.sql.SQLException
- If an error occurs.public java.util.Map queryForMap(java.lang.String id, java.lang.Object paramObject, java.lang.String keyProp) throws java.sql.SQLException
SqlMapExecutor
queryForMap
in interface SqlMapExecutor
queryForMap
in interface ExtendedSqlMapClient
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.
java.sql.SQLException
- If an error occurs.public java.util.Map queryForMap(java.lang.String id, java.lang.Object paramObject, java.lang.String keyProp, java.lang.String valueProp) throws java.sql.SQLException
SqlMapExecutor
queryForMap
in interface SqlMapExecutor
queryForMap
in interface ExtendedSqlMapClient
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.
java.sql.SQLException
- If an error occurs.public void queryWithRowHandler(java.lang.String id, java.lang.Object paramObject, RowHandler rowHandler) throws java.sql.SQLException
SqlMapExecutor
queryWithRowHandler
in interface SqlMapExecutor
queryWithRowHandler
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.paramObject
- The parameter object (e.g. JavaBean, Map, XML etc.).rowHandler
- A RowHandler instance
java.sql.SQLException
- If an error occurs.public void queryWithRowHandler(java.lang.String id, RowHandler rowHandler) throws java.sql.SQLException
SqlMapExecutor
queryWithRowHandler
in interface SqlMapExecutor
queryWithRowHandler
in interface ExtendedSqlMapClient
id
- The name of the statement to execute.rowHandler
- A RowHandler instance
java.sql.SQLException
- If an error occurs.public void startTransaction() throws java.sql.SQLException
SqlMapTransactionManager
try { sqlMap.startTransaction(); // do work sqlMap.commitTransaction(); } finally { sqlMap.endTransaction(); }Always call endTransaction() once startTransaction() has been called.
startTransaction
in interface SqlMapTransactionManager
startTransaction
in interface ExtendedSqlMapClient
java.sql.SQLException
- If an error occurs while starting the transaction, or
the transaction could not be started.public void startTransaction(int transactionIsolation) throws java.sql.SQLException
SqlMapTransactionManager
try { sqlMap.startTransaction(Connection.TRANSACTION_REPEATABLE_READ); // do work sqlMap.commitTransaction(); } finally { sqlMap.endTransaction(); }Always call endTransaction() once startTransaction() has been called.
startTransaction
in interface SqlMapTransactionManager
startTransaction
in interface ExtendedSqlMapClient
java.sql.SQLException
- If an error occurs while starting the transaction, or
the transaction could not be started.public void commitTransaction() throws java.sql.SQLException
SqlMapTransactionManager
commitTransaction
in interface SqlMapTransactionManager
commitTransaction
in interface ExtendedSqlMapClient
java.sql.SQLException
- If an error occurs while committing the transaction, or
the transaction could not be committed.public void endTransaction() throws java.sql.SQLException
SqlMapTransactionManager
endTransaction
in interface SqlMapTransactionManager
endTransaction
in interface ExtendedSqlMapClient
java.sql.SQLException
- If an error occurs during rollback or the transaction could
not be ended.public void startBatch() throws java.sql.SQLException
SqlMapExecutor
startBatch
in interface SqlMapExecutor
startBatch
in interface ExtendedSqlMapClient
java.sql.SQLException
- If the batch could not be started.public int executeBatch() throws java.sql.SQLException
SqlMapExecutor
executeBatch
in interface SqlMapExecutor
executeBatch
in interface ExtendedSqlMapClient
java.sql.SQLException
- If the batch could not be executed or if any of the statements
fails.public java.util.List executeBatchDetailed() throws java.sql.SQLException, BatchException
SqlMapExecutor
executeBatchDetailed
in interface SqlMapExecutor
executeBatchDetailed
in interface ExtendedSqlMapClient
java.sql.SQLException
- if a database access error occurs, or the drive
does not support batch statements
BatchException
- if the driver throws BatchUpdateExceptionBatchException
public void setUserConnection(java.sql.Connection connection) throws java.sql.SQLException
SqlMapTransactionManager
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 } }
setUserConnection
in interface SqlMapTransactionManager
setUserConnection
in interface ExtendedSqlMapClient
java.sql.SQLException
public java.sql.Connection getUserConnection() throws java.sql.SQLException
getUserConnection
in interface SqlMapTransactionManager
getUserConnection
in interface ExtendedSqlMapClient
java.sql.SQLException
public java.sql.Connection getCurrentConnection() throws java.sql.SQLException
SqlMapTransactionManager
getCurrentConnection
in interface SqlMapTransactionManager
getCurrentConnection
in interface ExtendedSqlMapClient
java.sql.SQLException
public javax.sql.DataSource getDataSource()
SqlMapTransactionManager
getDataSource
in interface SqlMapTransactionManager
getDataSource
in interface ExtendedSqlMapClient
public MappedStatement getMappedStatement(java.lang.String id)
getMappedStatement
in interface ExtendedSqlMapClient
public boolean isLazyLoadingEnabled()
isLazyLoadingEnabled
in interface ExtendedSqlMapClient
public boolean isEnhancementEnabled()
isEnhancementEnabled
in interface ExtendedSqlMapClient
public SqlExecutor getSqlExecutor()
getSqlExecutor
in interface ExtendedSqlMapClient
public SqlMapExecutorDelegate getDelegate()
getDelegate
in interface ExtendedSqlMapClient
public SqlMapSession openSession()
SqlMapClient
openSession
in interface SqlMapClient
openSession
in interface ExtendedSqlMapClient
public SqlMapSession openSession(java.sql.Connection conn)
SqlMapClient
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 } }
openSession
in interface SqlMapClient
openSession
in interface ExtendedSqlMapClient
conn
- - the connection to use for the session
public SqlMapSession getSession()
getSession
in interface SqlMapClient
getSession
in interface ExtendedSqlMapClient
public void flushDataCache()
SqlMapClient
flushDataCache
in interface SqlMapClient
flushDataCache
in interface ExtendedSqlMapClient
public void flushDataCache(java.lang.String cacheId)
SqlMapClient
flushDataCache
in interface SqlMapClient
flushDataCache
in interface ExtendedSqlMapClient
cacheId
- The cache model to flushprotected SqlMapSessionImpl getLocalSqlMapSession()
public ResultObjectFactory getResultObjectFactory()
getResultObjectFactory
in interface ExtendedSqlMapClient
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造器 | 方法 | 详细信息: 字段 | 构造器 | 方法 |