public class SimpleDslSession extends Object implements DslSession
Constructor and Description |
---|
SimpleDslSession(DataSource dataSource) |
SimpleDslSession(DataSource dataSource,
org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer) |
SimpleDslSession(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) |
Modifier and Type | Method and Description |
---|---|
<T> int[] |
batchDelete(Delete delete,
Class<T> requiredType,
List<T> params) |
<T> int[] |
batchDelete(Delete delete,
Class<T> requiredType,
List<T> params,
int batchSize) |
int[] |
batchDelete(Delete delete,
List<List<Object>> params) |
int[] |
batchDelete(Delete delete,
List<List<Object>> params,
int batchSize)
批量删除
|
int[] |
batchDelete(Delete delete,
Map<String,Object>[] params) |
int[] |
batchDelete(Delete delete,
Map<String,Object>[] params,
int batchSize) |
int[] |
batchDelete(List<Delete> deletes)
执行多句删除语句
|
<T> int[] |
batchInsert(Insert insert,
Class<T> requiredType,
List<T> params) |
<T> int[] |
batchInsert(Insert insert,
Class<T> requiredType,
List<T> params,
int batchSize) |
<T> int[] |
batchInsert(Insert insert,
Class<T> requiredType,
List<T> params,
int batchSize,
boolean autoGeneratedKeys)
批量新增
|
int[] |
batchInsert(Insert insert,
List<Map<String,Object>> params) |
int[] |
batchInsert(Insert insert,
List<Map<String,Object>> params,
boolean autoGeneratedKeys)
批量新增 最大batchsize
|
int[] |
batchInsert(Insert insert,
List<Map<String,Object>> params,
int batchSize) |
int[] |
batchInsert(Insert insert,
List<Map<String,Object>> params,
int batchSize,
boolean autoGeneratedKeys)
批量新增
|
int[] |
batchInsert(List<Insert> inserts,
boolean autoGeneratedKeys)
执行多句insert语句
|
int[] |
batchUpdate(List<Update> updates)
执行多句更新语句
|
<T> int[] |
batchUpdate(Update update,
Class<T> requiredType,
List<T> params) |
<T> int[] |
batchUpdate(Update update,
Class<T> requiredType,
List<T> params,
int batchSize) |
int[] |
batchUpdate(Update update,
List<List<Object>> params) |
int[] |
batchUpdate(Update update,
List<List<Object>> params,
int batchSize)
批量更新
|
int[] |
batchUpdate(Update update,
Map<String,Object>[] params) |
int[] |
batchUpdate(Update update,
Map<String,Object>[] params,
int batchSize) |
void |
beginTransaction()
开始事务
|
void |
commitTransaction()
提交事务
|
int |
count(ComplexSelect complexSelect)
查询总记录数
|
int |
count(Select select)
查询总记录数
|
int |
execute(Delete delete)
执行删除语句
|
int |
execute(Insert insert)
执行Insert语句,返回值为受影响记录数
|
int |
execute(Update update)
执行更新语句,默认是不忽略空值的
|
int |
execute(Update update,
boolean ignoreNull)
执行更新语句
|
<T> T |
executeAndReturnObject(Insert insert)
执行Insert语句,返回值为自增长的主键值,由数据库来生成主键值.该方法不能用于执行insert into。。。select语句
|
<T> T |
executeAndReturnObject(Insert insert,
Class<T> clazz)
执行Insert语句,返回值为自增长的主键值,由数据库来生成主键值.该方法不能用于执行insert into。。。select语句
|
<T> T |
executeAndReturnObject(Insert insert,
Class<T> clazz,
boolean autoGeneratedKeys)
执行Insert语句,返回值为自增长的主键值。该方法不能用于执行insert into。。。select语句
|
void |
extractResultSet(ComplexSelect complexSelect,
ResultSetCallback callback) |
void |
extractResultSet(Select select,
ResultSetCallback callback)
resultset处理
|
void |
extractResultSet(String sql,
Object[] values,
ResultSetCallback callback) |
<T> T[] |
fetchArray(ComplexSelect complexSelect,
Class<T> requiredType)
把所有的结果变成一个对象数组返回
|
<T> T[] |
fetchArray(Select select,
Class<T> requiredType)
把所有的结果变成一个对象数组返回
|
<T> Pager<T> |
fetchCursorPage(ComplexSelect complexSelect,
int start,
int limit,
Class<T> requiredType)
基于游标的分页方式,select对象生成的sql语句是不包含分页信息的
|
<T> Pager<T> |
fetchCursorPage(Select commonSelect,
int start,
int limit,
Class<T> requiredType)
基于游标的分页方式,select对象生成的sql语句是不包含分页信息的
|
<T> List<T> |
fetchCursorPageList(ComplexSelect complexSelect,
int start,
int limit,
Class<T> requiredType)
基于游标的分页方式,select对象生成的sql语句是不包含分页信息的
|
<T> List<T> |
fetchCursorPageList(Select commonSelect,
int start,
int limit,
Class<T> requiredType)
基于游标的分页方式,select对象生成的sql语句是不包含分页信息的
|
<T> Pager<T> |
fetchDialectPage(ComplexSelect complexSelect,
int start,
int limit,
Class<T> requiredType)
基于方言的分页方式,select对象生成的sql语句是包含分页信息的
|
<T> Pager<T> |
fetchDialectPage(Select commonSelect,
int start,
int limit,
Class<T> requiredType)
基于方言的分页方式,select对象生成的sql语句是包含分页信息的
|
<T> List<T> |
fetchDialectPageList(ComplexSelect complexSelect,
int start,
int limit,
Class<T> requiredType)
基于方言的分页方式,select对象生成的sql语句是包含分页信息的
|
<T> List<T> |
fetchDialectPageList(Select commonSelect,
int start,
int limit,
Class<T> requiredType)
基于方言的分页方式,select对象生成的sql语句是包含分页信息的
|
<T> List<T> |
fetchList(ComplexSelect complexSelect,
Class<T> requiredType)
把所有的结果变成一个对象列表返回
|
<T> List<T> |
fetchList(Select select,
Class<T> requiredType)
把所有的结果变成一个对象列表返回
|
<T> T |
fetchOneResult(ComplexSelect complexSelect,
Class<T> requiredType)
返回一个结果,既然是有多个结果也只返回第一个结果
|
<T> T |
fetchOneResult(Select select,
Class<T> requiredType)
返回一个结果,既然是有多个结果也只返回第一个结果
|
<T> Pager<T> |
fetchPage(ComplexSelect complexSelect,
int start,
int limit,
boolean isCursor,
Class<T> requiredType)
分页处理
|
<T> Pager<T> |
fetchPage(Select commonSelect,
int start,
int limit,
boolean isCursor,
Class<T> requiredType)
分页处理
|
<T> List<T> |
fetchPageList(ComplexSelect complexSelect,
int start,
int limit,
boolean isCursor,
Class<T> requiredType)
分页处理
|
<T> List<T> |
fetchPageList(Select commonSelect,
int start,
int limit,
boolean isCursor,
Class<T> requiredType)
分页处理
|
Configuration |
getConfiguration() |
org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer |
getIncrementer() |
org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate() |
PageSqlProcessSelector |
getPageSelector() |
RowMapperSelector |
getSelector() |
org.springframework.transaction.TransactionDefinition |
getTransactionDefinition() |
org.springframework.transaction.PlatformTransactionManager |
getTransactionManager() |
void |
rollbackTransaction()
回滚事务
|
void |
setIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer) |
void |
setPageSelector(PageSqlProcessSelector pageSelector) |
void |
setSelector(RowMapperSelector selector) |
void |
setTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition) |
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) |
public SimpleDslSession(DataSource dataSource)
public SimpleDslSession(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
public SimpleDslSession(DataSource dataSource, org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer)
public RowMapperSelector getSelector()
public void setSelector(RowMapperSelector selector)
public org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer getIncrementer()
public void setIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer)
public Configuration getConfiguration()
public PageSqlProcessSelector getPageSelector()
public void setPageSelector(PageSqlProcessSelector pageSelector)
public org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate()
public int execute(Insert insert)
DslSession
execute
in interface DslSession
public <T> T executeAndReturnObject(Insert insert)
DslSession
executeAndReturnObject
in interface DslSession
public <T> T executeAndReturnObject(Insert insert, Class<T> clazz)
DslSession
executeAndReturnObject
in interface DslSession
clazz
- 返回对象的类型public <T> T executeAndReturnObject(Insert insert, Class<T> clazz, boolean autoGeneratedKeys)
DslSession
executeAndReturnObject
in interface DslSession
autoGeneratedKeys
- true:由数据库来生成主键值,false:由应用层来生成主键public int execute(Update update)
DslSession
execute
in interface DslSession
public int execute(Update update, boolean ignoreNull)
DslSession
execute
in interface DslSession
update
- 更新语句ignoreNull
- 忽略空值public int execute(Delete delete)
DslSession
execute
in interface DslSession
public <T> T fetchOneResult(Select select, Class<T> requiredType)
DslSession
fetchOneResult
in interface DslSession
public <T> T[] fetchArray(Select select, Class<T> requiredType)
DslSession
fetchArray
in interface DslSession
public <T> List<T> fetchList(Select select, Class<T> requiredType)
DslSession
fetchList
in interface DslSession
public <T> T[] fetchArray(ComplexSelect complexSelect, Class<T> requiredType)
DslSession
fetchArray
in interface DslSession
public <T> List<T> fetchList(ComplexSelect complexSelect, Class<T> requiredType)
DslSession
fetchList
in interface DslSession
public <T> T fetchOneResult(ComplexSelect complexSelect, Class<T> requiredType)
DslSession
fetchOneResult
in interface DslSession
public <T> Pager<T> fetchPage(Select commonSelect, int start, int limit, boolean isCursor, Class<T> requiredType)
DslSession
fetchPage
in interface DslSession
public <T> Pager<T> fetchCursorPage(Select commonSelect, int start, int limit, Class<T> requiredType)
DslSession
fetchCursorPage
in interface DslSession
commonSelect
- 普通sql,分页sql由框架组装public <T> Pager<T> fetchDialectPage(Select commonSelect, int start, int limit, Class<T> requiredType)
DslSession
fetchDialectPage
in interface DslSession
commonSelect
- 普通sql,分页sql由框架组装public int count(Select select)
DslSession
count
in interface DslSession
public int[] batchInsert(Insert insert, List<Map<String,Object>> params)
batchInsert
in interface DslSession
public int[] batchInsert(Insert insert, List<Map<String,Object>> params, int batchSize)
batchInsert
in interface DslSession
public int[] batchInsert(Insert insert, List<Map<String,Object>> params, int batchSize, boolean autoGeneratedKeys)
DslSession
batchInsert
in interface DslSession
insert
- 生成批量新增的sql语句params
- 批量操作的参数batchSize
- 一次批量操作的最大数量autoGeneratedKeys
- 主键值是否由数据库自动生成public int[] batchInsert(Insert insert, List<Map<String,Object>> params, boolean autoGeneratedKeys)
DslSession
batchInsert
in interface DslSession
public <T> int[] batchInsert(Insert insert, Class<T> requiredType, List<T> params)
batchInsert
in interface DslSession
public <T> int[] batchInsert(Insert insert, Class<T> requiredType, List<T> params, int batchSize)
batchInsert
in interface DslSession
public <T> int[] batchInsert(Insert insert, Class<T> requiredType, List<T> params, int batchSize, boolean autoGeneratedKeys)
DslSession
batchInsert
in interface DslSession
insert
- 生成批量新增的sql语句params
- 批量操作的参数batchSize
- 一次批量操作的最大数量autoGeneratedKeys
- 主键值是否由数据库自动生成public int[] batchUpdate(Update update, List<List<Object>> params)
batchUpdate
in interface DslSession
public int[] batchUpdate(Update update, List<List<Object>> params, int batchSize)
DslSession
batchUpdate
in interface DslSession
update
- 生成update 语句params
- 参数batchSize
- 一次批量更新的最大数量public int[] batchDelete(Delete delete, List<List<Object>> params)
batchDelete
in interface DslSession
public int[] batchDelete(Delete delete, List<List<Object>> params, int batchSize)
DslSession
batchDelete
in interface DslSession
delete
- 生成delete语句params
- 参数batchSize
- 一次批量删除的最大数量public int[] batchUpdate(Update update, Map<String,Object>[] params)
batchUpdate
in interface DslSession
public <T> int[] batchUpdate(Update update, Class<T> requiredType, List<T> params)
batchUpdate
in interface DslSession
public int[] batchUpdate(Update update, Map<String,Object>[] params, int batchSize)
batchUpdate
in interface DslSession
public <T> int[] batchUpdate(Update update, Class<T> requiredType, List<T> params, int batchSize)
batchUpdate
in interface DslSession
public int[] batchDelete(Delete delete, Map<String,Object>[] params)
batchDelete
in interface DslSession
public <T> int[] batchDelete(Delete delete, Class<T> requiredType, List<T> params)
batchDelete
in interface DslSession
public int[] batchDelete(Delete delete, Map<String,Object>[] params, int batchSize)
batchDelete
in interface DslSession
public <T> int[] batchDelete(Delete delete, Class<T> requiredType, List<T> params, int batchSize)
batchDelete
in interface DslSession
public void extractResultSet(String sql, Object[] values, ResultSetCallback callback)
extractResultSet
in interface DslSession
public void extractResultSet(Select select, ResultSetCallback callback)
DslSession
extractResultSet
in interface DslSession
callback
- 结果集回调接口,在回调方法进行resultset处理public void extractResultSet(ComplexSelect complexSelect, ResultSetCallback callback)
extractResultSet
in interface DslSession
public void beginTransaction()
DslSession
beginTransaction
in interface DslSession
public void commitTransaction()
DslSession
commitTransaction
in interface DslSession
public void rollbackTransaction()
DslSession
rollbackTransaction
in interface DslSession
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
public org.springframework.transaction.TransactionDefinition getTransactionDefinition()
public void setTransactionDefinition(org.springframework.transaction.TransactionDefinition transactionDefinition)
public int[] batchInsert(List<Insert> inserts, boolean autoGeneratedKeys)
DslSession
batchInsert
in interface DslSession
autoGeneratedKeys
- 是否启动主键值自动生成public int[] batchUpdate(List<Update> updates)
DslSession
batchUpdate
in interface DslSession
public int[] batchDelete(List<Delete> deletes)
DslSession
batchDelete
in interface DslSession
public <T> List<T> fetchPageList(Select commonSelect, int start, int limit, boolean isCursor, Class<T> requiredType)
DslSession
fetchPageList
in interface DslSession
commonSelect
- 普通sql,分页sql由框架组装public <T> List<T> fetchCursorPageList(Select commonSelect, int start, int limit, Class<T> requiredType)
DslSession
fetchCursorPageList
in interface DslSession
commonSelect
- 普通sql,分页sql由框架组装public <T> List<T> fetchDialectPageList(Select commonSelect, int start, int limit, Class<T> requiredType)
DslSession
fetchDialectPageList
in interface DslSession
commonSelect
- 普通sql,分页sql由框架组装public <T> Pager<T> fetchPage(ComplexSelect complexSelect, int start, int limit, boolean isCursor, Class<T> requiredType)
DslSession
fetchPage
in interface DslSession
complexSelect
- 普通sql,分页sql由框架组装public <T> Pager<T> fetchCursorPage(ComplexSelect complexSelect, int start, int limit, Class<T> requiredType)
DslSession
fetchCursorPage
in interface DslSession
complexSelect
- 普通sql,分页sql由框架组装public <T> Pager<T> fetchDialectPage(ComplexSelect complexSelect, int start, int limit, Class<T> requiredType)
DslSession
fetchDialectPage
in interface DslSession
complexSelect
- 普通sql,分页sql由框架组装public <T> List<T> fetchPageList(ComplexSelect complexSelect, int start, int limit, boolean isCursor, Class<T> requiredType)
DslSession
fetchPageList
in interface DslSession
complexSelect
- 普通sql,分页sql由框架组装public <T> List<T> fetchCursorPageList(ComplexSelect complexSelect, int start, int limit, Class<T> requiredType)
DslSession
fetchCursorPageList
in interface DslSession
complexSelect
- 普通sql,分页sql由框架组装public <T> List<T> fetchDialectPageList(ComplexSelect complexSelect, int start, int limit, Class<T> requiredType)
DslSession
fetchDialectPageList
in interface DslSession
complexSelect
- 普通sql,分页sql由框架组装public int count(ComplexSelect complexSelect)
DslSession
count
in interface DslSession
Copyright © 2006–2018 TinyGroup. All rights reserved.