public interface Delegator
数据库委托代理访问接口
Modifier and Type | Method and Description |
---|---|
void |
beginTransaction()
开启一个事务
|
void |
commitTransaction()
提交一个事务
|
int |
countByAnd(Class<?> entityClazz,
Map<String,Object> andMap) |
int |
countByCond(Class<?> entityClazz,
String cond) |
int |
countByRawQuery(String query,
String countAlias) |
int |
countByRawQuery(String query,
String countAlias,
List<?> params) |
void |
endTransaction()
结束一个事务
|
int |
executeByRawSql(String sql) |
int |
executeByRawSql(String sql,
List<?> params) |
Object |
executeWithInTx(TxCallable txCallable) |
void |
executeWithInTx(TxRunnable txRunnable) |
Object |
findById(Class<?> entityClazz,
Object id) |
Object |
findById(Class<?> entityClazz,
Object id,
boolean useCache) |
Object |
findById(Class<?> entityClazz,
Object id,
boolean useCache,
int liveTimeInSeconds) |
List<Object> |
findIdsByAnd(Class<?> entityClazz,
Map<String,Object> andMap) |
List<Object> |
findIdsByCond(Class<?> entityClazz,
String cond) |
List<?> |
findListByAnd(Class<?> entityClazz,
Map<String,Object> andMap) |
List<?> |
findListByAnd(Class<?> entityClazz,
Map<String,Object> andMap,
List<String> orderBy) |
List<?> |
findListByAnd(Class<?> entityClazz,
Map<String,Object> andMap,
Set<String> fieldsToSelect,
List<String> orderBy,
boolean useCache) |
List<?> |
findListByAnd(Class<?> entityClazz,
Map<String,Object> andMap,
Set<String> fieldsToSelect,
List<String> orderBy,
boolean useCache,
int liveTimeInSeconds) |
List<?> |
findListByCond(Class<?> entityClazz,
String cond) |
List<?> |
findListByCond(Class<?> entityClazz,
String cond,
Set<String> fieldsToSelect,
List<String> orderBy) |
List<?> |
findListByCond(Class<?> entityClazz,
String cond,
Set<String> fieldsToSelect,
List<String> orderBy,
boolean useCache) |
List<?> |
findListByCond(Class<?> entityClazz,
String cond,
Set<String> fieldsToSelect,
List<String> orderBy,
boolean useCache,
int liveTimeInSeconds) |
List<Map<String,Object>> |
findListByRawQuery(String query,
List<?> params) |
List<Map<String,Object>> |
findListByRawQuery(String query,
List<?> params,
boolean useCache) |
Map<String,Object> |
findPageByAnd(Class<?> entityClazz,
Map<String,Object> andMap,
int pageNo,
int pageSize) |
Map<String,Object> |
findPageByAnd(Class<?> entityClazz,
Map<String,Object> andMap,
int pageNo,
int pageSize,
Set<String> fieldsToSelect,
List<String> orderBy) |
Map<String,Object> |
findPageByAnd(Class<?> entityClazz,
Map<String,Object> andMap,
int pageNo,
int pageSize,
Set<String> fieldsToSelect,
List<String> orderBy,
boolean useCache) |
Map<String,Object> |
findPageByAnd(Class<?> entityClazz,
Map<String,Object> andMap,
int pageNo,
int pageSize,
Set<String> fieldsToSelect,
List<String> orderBy,
boolean useCache,
int liveTimeInSeconds) |
Map<String,Object> |
findPageByCond(Class<?> entityClazz,
String cond,
int pageNo,
int pageSize) |
Map<String,Object> |
findPageByCond(Class<?> entityClazz,
String cond,
int pageNo,
int pageSize,
Set<String> fieldsToSelect,
List<String> orderBy) |
Map<String,Object> |
findPageByCond(Class<?> entityClazz,
String cond,
int pageNo,
int pageSize,
Set<String> fieldsToSelect,
List<String> orderBy,
boolean useCache) |
Map<String,Object> |
findPageByCond(Class<?> entityClazz,
String cond,
int pageNo,
int pageSize,
Set<String> fieldsToSelect,
List<String> orderBy,
boolean useCache,
int liveTimeInSeconds) |
Object |
findUniqueByAnd(Class<?> entityClazz,
Map<String,Object> andMap) |
Object |
findUniqueByAnd(Class<?> entityClazz,
Map<String,Object> andMap,
Set<String> fieldsToSelect,
boolean useCache) |
Object |
findUniqueByAnd(Class<?> entityClazz,
Map<String,Object> andMap,
Set<String> fieldsToSelect,
boolean useCache,
int liveTimeInSeconds) |
Connection |
getConnection()
获取原始的数据库连接
|
void |
loadSeedData(String seedDataSqlCvs) |
void |
remove(Collection<?> entities) |
void |
remove(Object entity) |
void |
removeById(Class<?> entityClazz,
Object id) |
void |
rollback()
回滚一个事务
|
void |
save(Collection<?> entities) |
void |
save(Object entity) |
void |
update(Collection<?> entities) |
void |
update(Object entity) |
Delegator |
useDataSource(String name)
使用指定的数据源,实现方应该可以通过指定的名称,切换到该数据源下。以支持多数据源特性。
|
Connection getConnection() throws GenericEntityException
获取原始的数据库连接
GenericEntityException
Delegator useDataSource(String name)
使用指定的数据源,实现方应该可以通过指定的名称,切换到该数据源下。以支持多数据源特性。
name
- 要使用的数据源名称Delegator
本身,返回自己的目的是可以实现接口的链式访问。void beginTransaction()
开启一个事务
void rollback()
回滚一个事务
void commitTransaction()
提交一个事务
void endTransaction()
结束一个事务
void executeWithInTx(TxRunnable txRunnable)
txRunnable
- Object executeWithInTx(TxCallable txCallable)
txCallable
- void save(Collection<?> entities) throws GenericEntityException
GenericEntityException
void save(Object entity) throws GenericEntityException
GenericEntityException
void update(Collection<?> entities) throws GenericEntityException
GenericEntityException
void update(Object entity) throws GenericEntityException
GenericEntityException
void remove(Collection<?> entities) throws GenericEntityException
GenericEntityException
void remove(Object entity) throws GenericEntityException
GenericEntityException
void removeById(Class<?> entityClazz, Object id) throws GenericEntityException
GenericEntityException
Object findById(Class<?> entityClazz, Object id) throws GenericEntityException
GenericEntityException
Object findById(Class<?> entityClazz, Object id, boolean useCache) throws GenericEntityException
GenericEntityException
Object findById(Class<?> entityClazz, Object id, boolean useCache, int liveTimeInSeconds) throws GenericEntityException
GenericEntityException
List<Object> findIdsByAnd(Class<?> entityClazz, Map<String,Object> andMap) throws GenericEntityException
GenericEntityException
List<Object> findIdsByCond(Class<?> entityClazz, String cond) throws GenericEntityException
GenericEntityException
List<?> findListByAnd(Class<?> entityClazz, Map<String,Object> andMap) throws GenericEntityException
GenericEntityException
List<?> findListByAnd(Class<?> entityClazz, Map<String,Object> andMap, List<String> orderBy) throws GenericEntityException
GenericEntityException
List<?> findListByAnd(Class<?> entityClazz, Map<String,Object> andMap, Set<String> fieldsToSelect, List<String> orderBy, boolean useCache) throws GenericEntityException
GenericEntityException
List<?> findListByAnd(Class<?> entityClazz, Map<String,Object> andMap, Set<String> fieldsToSelect, List<String> orderBy, boolean useCache, int liveTimeInSeconds) throws GenericEntityException
GenericEntityException
Object findUniqueByAnd(Class<?> entityClazz, Map<String,Object> andMap) throws GenericEntityException
GenericEntityException
Object findUniqueByAnd(Class<?> entityClazz, Map<String,Object> andMap, Set<String> fieldsToSelect, boolean useCache) throws GenericEntityException
GenericEntityException
Object findUniqueByAnd(Class<?> entityClazz, Map<String,Object> andMap, Set<String> fieldsToSelect, boolean useCache, int liveTimeInSeconds) throws GenericEntityException
GenericEntityException
List<?> findListByCond(Class<?> entityClazz, String cond) throws GenericEntityException
GenericEntityException
List<?> findListByCond(Class<?> entityClazz, String cond, Set<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException
GenericEntityException
List<?> findListByCond(Class<?> entityClazz, String cond, Set<String> fieldsToSelect, List<String> orderBy, boolean useCache) throws GenericEntityException
GenericEntityException
List<?> findListByCond(Class<?> entityClazz, String cond, Set<String> fieldsToSelect, List<String> orderBy, boolean useCache, int liveTimeInSeconds) throws GenericEntityException
GenericEntityException
Map<String,Object> findPageByAnd(Class<?> entityClazz, Map<String,Object> andMap, int pageNo, int pageSize) throws GenericEntityException
GenericEntityException
Map<String,Object> findPageByAnd(Class<?> entityClazz, Map<String,Object> andMap, int pageNo, int pageSize, Set<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException
GenericEntityException
Map<String,Object> findPageByAnd(Class<?> entityClazz, Map<String,Object> andMap, int pageNo, int pageSize, Set<String> fieldsToSelect, List<String> orderBy, boolean useCache) throws GenericEntityException
GenericEntityException
Map<String,Object> findPageByAnd(Class<?> entityClazz, Map<String,Object> andMap, int pageNo, int pageSize, Set<String> fieldsToSelect, List<String> orderBy, boolean useCache, int liveTimeInSeconds) throws GenericEntityException
GenericEntityException
Map<String,Object> findPageByCond(Class<?> entityClazz, String cond, int pageNo, int pageSize) throws GenericEntityException
GenericEntityException
Map<String,Object> findPageByCond(Class<?> entityClazz, String cond, int pageNo, int pageSize, Set<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException
GenericEntityException
Map<String,Object> findPageByCond(Class<?> entityClazz, String cond, int pageNo, int pageSize, Set<String> fieldsToSelect, List<String> orderBy, boolean useCache) throws GenericEntityException
GenericEntityException
Map<String,Object> findPageByCond(Class<?> entityClazz, String cond, int pageNo, int pageSize, Set<String> fieldsToSelect, List<String> orderBy, boolean useCache, int liveTimeInSeconds) throws GenericEntityException
GenericEntityException
int countByAnd(Class<?> entityClazz, Map<String,Object> andMap) throws GenericEntityException
GenericEntityException
int countByCond(Class<?> entityClazz, String cond) throws GenericEntityException
GenericEntityException
List<Map<String,Object>> findListByRawQuery(String query, List<?> params) throws GenericEntityException
GenericEntityException
List<Map<String,Object>> findListByRawQuery(String query, List<?> params, boolean useCache) throws GenericEntityException
GenericEntityException
int executeByRawSql(String sql) throws GenericEntityException
GenericEntityException
int executeByRawSql(String sql, List<?> params) throws GenericEntityException
GenericEntityException
int countByRawQuery(String query, String countAlias) throws GenericEntityException
GenericEntityException
int countByRawQuery(String query, String countAlias, List<?> params) throws GenericEntityException
GenericEntityException
void loadSeedData(String seedDataSqlCvs) throws GenericEntityException
GenericEntityException
Copyright © 2016 huihoo. All rights reserved.