public class BHiveSqlSessionDaoSupport extends Object implements org.springframework.beans.factory.InitializingBean
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger
Logger available to subclasses
|
| Constructor and Description |
|---|
BHiveSqlSessionDaoSupport() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected void |
checkDaoConfig()
Abstract subclasses can override this to check their configuration.
|
protected void |
clearCache()
Clears local session cache
|
protected void |
close()
Closes the session
|
protected void |
commit()
Flushes batch statements and commits database connection.
|
protected void |
commit(boolean force)
Flushes batch statements and commits database connection.
|
protected int |
delete(String statement)
Execute a delete statement.
|
protected int |
delete(String statement,
Object parameter)
Execute a delete statement.
|
protected List<org.apache.ibatis.executor.BatchResult> |
flushStatements()
Flushes batch statements.
|
protected org.apache.ibatis.session.Configuration |
getConfiguration()
Retrieves current configuration
|
protected Connection |
getConnection()
Retrieves inner database connection
|
static String |
getCurrentMethodName()
Retrieves current method name
|
protected <T> T |
getMapper(Class<T> type)
Retrieves a mapper.
|
protected org.apache.ibatis.session.SqlSession |
getSqlSession()
Users should use this method to get a SqlSession to call its statement
methods This is SqlSession is managed by spring.
|
protected void |
initDao()
Concrete subclasses can override this for custom initialization behavior.
|
protected int |
insert(String statement)
Execute an insert statement.
|
protected int |
insert(String statement,
Object parameter)
Execute an insert statement with the given parameter object.
|
protected void |
rollback()
Discards pending batch statements and rolls database connection back.
|
protected void |
rollback(boolean force)
Discards pending batch statements and rolls database connection back.
|
protected void |
select(String statement,
Object parameter,
org.apache.ibatis.session.ResultHandler<?> handler)
Retrieve a single row mapped from the statement key and parameter using a
ResultHandler. |
protected void |
select(String statement,
Object parameter,
org.apache.ibatis.session.RowBounds rowBounds,
org.apache.ibatis.session.ResultHandler<?> handler)
Retrieve a single row mapped from the statement key and parameter using a
ResultHandler and RowBounds |
protected void |
select(String statement,
org.apache.ibatis.session.ResultHandler<?> handler)
Retrieve a single row mapped from the statement using a
ResultHandler. |
protected <E> List<E> |
selectList(String statement)
Retrieve a list of mapped objects from the statement key and parameter.
|
protected <E> List<E> |
selectList(String statement,
Object parameter)
Retrieve a list of mapped objects from the statement key and parameter.
|
protected <E> List<E> |
selectList(String statement,
Object parameter,
org.apache.ibatis.session.RowBounds rowBounds)
Retrieve a list of mapped objects from the statement key and parameter,
within the specified row bounds.
|
protected <K,V> Map<K,V> |
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.
|
protected <K,V> Map<K,V> |
selectMap(String statement,
Object parameter,
String mapKey,
org.apache.ibatis.session.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.
|
protected <K,V> Map<K,V> |
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.
|
protected <T> T |
selectOne(String statement)
Retrieve a single row mapped from the statement key
|
protected <T> T |
selectOne(String statement,
Object parameter)
Retrieve a single row mapped from the statement key and parameter.
|
void |
setSqlSession(org.apache.ibatis.session.SqlSession sqlSession) |
protected void |
setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory) |
protected void |
setSqlSessionTemplate(org.mybatis.spring.SqlSessionTemplate sqlSessionTemplate) |
protected int |
update(String statement)
Execute an update statement.
|
protected int |
update(String statement,
Object parameter)
Execute an update statement.
|
@Autowired public void setSqlSession(org.apache.ibatis.session.SqlSession sqlSession)
protected void setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
protected void setSqlSessionTemplate(org.mybatis.spring.SqlSessionTemplate sqlSessionTemplate)
public void afterPropertiesSet()
throws IllegalArgumentException,
org.springframework.beans.factory.BeanInitializationException
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanIllegalArgumentExceptionorg.springframework.beans.factory.BeanInitializationExceptionprotected void checkDaoConfig()
Implementors should be marked as final if concrete subclasses are
not supposed to override this template method themselves.
IllegalArgumentException - in case of illegal configurationprotected void initDao()
throws Exception
Exception - if DAO initialization fails (will be rethrown as a
BeanInitializationException)BeanInitializationExceptionprotected org.apache.ibatis.session.SqlSession getSqlSession()
protected <T> T selectOne(String statement)
T - the returned object typestatement - Unique identifier matching the statement to use.protected <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.protected <E> List<E> selectList(String statement)
E - the returned list element typestatement - Unique identifier matching the statement to use.protected <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.protected <E> List<E> selectList(String statement, Object parameter, org.apache.ibatis.session.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 retrievalprotected <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.protected <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.protected <K,V> Map<K,V> selectMap(String statement, Object parameter, String mapKey, org.apache.ibatis.session.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 retrievalprotected void select(String statement, Object parameter, org.apache.ibatis.session.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 rowprotected void select(String statement, org.apache.ibatis.session.ResultHandler<?> handler)
ResultHandler.statement - Unique identifier matching the statement to use.handler - ResultHandler that will handle each retrieved rowprotected void select(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds, org.apache.ibatis.session.ResultHandler<?> handler)
ResultHandler and RowBoundsstatement - Unique identifier matching the statement to use.parameter - A parameter object to pass to the statement.rowBounds - RowBound instance to limit the query resultshandler - ResultHandler that will handle each retrieved rowprotected int insert(String statement)
statement - Unique identifier matching the statement to execute.protected int insert(String statement, Object parameter)
statement - Unique identifier matching the statement to execute.parameter - A parameter object to pass to the statement.protected int update(String statement)
statement - Unique identifier matching the statement to execute.protected int update(String statement, Object parameter)
statement - Unique identifier matching the statement to execute.parameter - A parameter object to pass to the statement.protected int delete(String statement)
statement - Unique identifier matching the statement to execute.protected int delete(String statement, Object parameter)
statement - Unique identifier matching the statement to execute.parameter - A parameter object to pass to the statement.protected void commit()
SqlSession.commit(boolean)protected void commit(boolean force)
force - forces connection commitprotected void rollback()
SqlSession.rollback(boolean)protected void rollback(boolean force)
force - forces connection rollbackprotected List<org.apache.ibatis.executor.BatchResult> flushStatements()
protected void close()
protected void clearCache()
protected org.apache.ibatis.session.Configuration getConfiguration()
protected <T> T getMapper(Class<T> type)
T - the mapper typetype - Mapper interface classprotected Connection getConnection()
public static String getCurrentMethodName()
Copyright © 2018. All rights reserved.