|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface SqlSession
The primary Java interface for working with MyBatis. Through this interface you can execute commands, get mappers and manage transactions.
| Method Summary | ||
|---|---|---|
void |
clearCache()
Clears local session cache |
|
void |
close()
Closes the session |
|
void |
commit()
Flushes batch statements and commits database connection. |
|
void |
commit(boolean force)
Flushes batch statements and commits database connection. |
|
int |
delete(String statement)
Execute a delete statement. |
|
int |
delete(String statement,
Object parameter)
Execute a delete statement. |
|
List<BatchResult> |
flushStatements()
Flushes batch statements. |
|
Configuration |
getConfiguration()
Retrieves current configuration |
|
Connection |
getConnection()
Retrieves inner database connection |
|
|
getMapper(Class<T> type)
Retrieves a mapper. |
|
int |
insert(String statement)
Execute an insert statement. |
|
int |
insert(String statement,
Object parameter)
Execute an insert statement with the given parameter object. |
|
void |
rollback()
Discards pending batch statements and rolls database connection back. |
|
void |
rollback(boolean force)
Discards pending batch statements and rolls database connection back. |
|
void |
select(String statement,
Object parameter,
ResultHandler handler)
Retrieve a single row mapped from the statement key and parameter using a ResultHandler. |
|
void |
select(String statement,
Object parameter,
RowBounds rowBounds,
ResultHandler handler)
Retrieve a single row mapped from the statement key and parameter using a ResultHandler and RowBounds |
|
void |
select(String statement,
ResultHandler handler)
Retrieve a single row mapped from the statement using a ResultHandler. |
|
|
selectList(String statement)
Retrieve a list of mapped objects from the statement key and parameter. |
|
|
selectList(String statement,
Object parameter)
Retrieve a list of mapped objects from the statement key and parameter. |
|
|
selectList(String statement,
Object parameter,
RowBounds rowBounds)
Retrieve a list of mapped objects from the statement key and parameter, within the specified row bounds. |
|
|
selectMap(String statement,
Object parameter,
String mapKey)
The selectMap is a special case in that it is designed to convert a list of results into a Map based on one of the properties in the resulting objects. |
|
|
selectMap(String statement,
Object parameter,
String mapKey,
RowBounds rowBounds)
The selectMap is a special case in that it is designed to convert a list of results into a Map based on one of the properties in the resulting objects. |
|
|
selectMap(String statement,
String mapKey)
The selectMap is a special case in that it is designed to convert a list of results into a Map based on one of the properties in the resulting objects. |
|
|
selectOne(String statement)
Retrieve a single row mapped from the statement key |
|
|
selectOne(String statement,
Object parameter)
Retrieve a single row mapped from the statement key and parameter. |
|
int |
update(String statement)
Execute an update statement. |
|
int |
update(String statement,
Object parameter)
Execute an update statement. |
|
| Method Detail |
|---|
<T> T selectOne(String statement)
T - the returned object typestatement -
<T> T selectOne(String statement,
Object parameter)
T - the returned object typestatement - Unique identifier matching the statement to use.parameter - A parameter object to pass to the statement.
<E> List<E> selectList(String statement)
E - the returned list element typestatement - Unique identifier matching the statement to use.
<E> List<E> selectList(String statement,
Object parameter)
E - the returned list element typestatement - Unique identifier matching the statement to use.parameter - A parameter object to pass to the statement.
<E> List<E> selectList(String statement,
Object parameter,
RowBounds rowBounds)
E - the returned list element typestatement - Unique identifier matching the statement to use.parameter - A parameter object to pass to the statement.rowBounds - Bounds to limit object retrieval
<K,V> Map<K,V> selectMap(String statement,
String mapKey)
K - the returned Map keys typeV - the returned Map values typestatement - Unique identifier matching the statement to use.mapKey - The property to use as key for each value in the list.
<K,V> Map<K,V> selectMap(String statement,
Object parameter,
String mapKey)
K - the returned Map keys typeV - the returned Map values typestatement - Unique identifier matching the statement to use.parameter - A parameter object to pass to the statement.mapKey - The property to use as key for each value in the list.
<K,V> Map<K,V> selectMap(String statement,
Object parameter,
String mapKey,
RowBounds rowBounds)
K - the returned Map keys typeV - the returned Map values typestatement - Unique identifier matching the statement to use.parameter - A parameter object to pass to the statement.mapKey - The property to use as key for each value in the list.rowBounds - Bounds to limit object retrieval
void select(String statement,
Object parameter,
ResultHandler handler)
ResultHandler.
statement - Unique identifier matching the statement to use.parameter - A parameter object to pass to the statement.handler - ResultHandler that will handle each retrieved row
void select(String statement,
ResultHandler handler)
ResultHandler.
statement - Unique identifier matching the statement to use.handler - ResultHandler that will handle each retrieved row
void select(String statement,
Object parameter,
RowBounds rowBounds,
ResultHandler handler)
ResultHandler and RowBounds
statement - Unique identifier matching the statement to use.rowBounds - RowBound instance to limit the query resultshandler - ResultHandler that will handle each retrieved rowint insert(String statement)
statement - Unique identifier matching the statement to execute.
int insert(String statement,
Object parameter)
statement - Unique identifier matching the statement to execute.parameter - A parameter object to pass to the statement.
int update(String statement)
statement - Unique identifier matching the statement to execute.
int update(String statement,
Object parameter)
statement - Unique identifier matching the statement to execute.parameter - A parameter object to pass to the statement.
int delete(String statement)
statement - Unique identifier matching the statement to execute.
int delete(String statement,
Object parameter)
statement - Unique identifier matching the statement to execute.parameter - A parameter object to pass to the statement.
void commit()
commit(boolean)
void commit(boolean force)
force - forces connection commitvoid rollback()
rollback(boolean)
void rollback(boolean force)
force - forces connection rollbackList<BatchResult> flushStatements()
void close()
void clearCache()
Configuration getConfiguration()
<T> T getMapper(Class<T> type)
T - the mapper typetype - Mapper interface class
Connection getConnection()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||