public class DefaultDatabaseSession extends AbstractSession<IDatabaseConnectionHolder> implements IDatabaseSession
Constructor and Description |
---|
DefaultDatabaseSession(IDatabase owner) |
DefaultDatabaseSession(IDatabase owner,
IDatabaseConnectionHolder connectionHolder) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
<T extends IEntity> |
count(Class<T> entityClass)
计算查询结果总记录数量
|
<T extends IEntity> |
count(Class<T> entityClass,
Where where)
计算查询结果总记录数量
|
<T extends IEntity> |
count(Class<T> entityClass,
Where where,
IShardingable shardingable)
计算查询结果总记录数量
|
long |
count(SQL sql)
计算查询结果总记录数量
|
<T extends IEntity> |
delete(Class<T> entityClass,
Serializable id)
根据实体类型执行记录删除
|
<T extends IEntity> |
delete(Class<T> entityClass,
Serializable[] ids)
根据实体类型执行记录批量删除
|
<T extends IEntity> |
delete(Class<T> entityClass,
Serializable id,
IShardingable shardingable)
根据实体类型执行记录删除
|
<T extends IEntity> |
delete(Class<T> entityClass,
ShardingList<Serializable> ids)
根据实体类型执行记录批量删除
|
<T extends IEntity> |
delete(List<T> entities)
根据实体执行记录批量删除
|
<T extends IEntity> |
delete(ShardingList<T> entities)
根据实体执行记录批量删除
|
<T extends IEntity> |
delete(T entity)
根据实体执行记录删除
|
<T extends IEntity> |
delete(T entity,
IShardingable shardingable)
根据实体执行记录删除
|
int[] |
executeForUpdate(BatchSQL sql)
执行SQL批量更新(如批更新、插入和删除)
|
int |
executeForUpdate(SQL sql)
执行SQL更新(如更新、插入和删除
|
<T extends IEntity> |
find(EntitySQL<T> entity)
根据实体执行SQL查询
|
<T extends IEntity> |
find(EntitySQL<T> entity,
IShardingable shardingable)
根据实体执行SQL查询
|
<T extends IEntity> |
find(EntitySQL<T> entity,
Page page)
根据实体执行SQL分页查询(执行总记录数统计)
|
<T extends IEntity> |
find(EntitySQL<T> entity,
Page page,
IShardingable shardingable)
根据实体执行SQL分页查询(执行总记录数统计)
|
<T extends IEntity> |
find(EntitySQL<T> entity,
Serializable id)
通过ID查找指定的实体对象
|
<T extends IEntity> |
find(EntitySQL<T> entity,
Serializable id,
IShardingable shardingable)
通过ID查找指定的实体对象
|
<T extends IEntity> |
find(EntitySQL<T> entity,
Where where)
根据实体执行SQL查询
|
<T extends IEntity> |
find(EntitySQL<T> entity,
Where where,
IShardingable shardingable)
根据实体执行SQL查询
|
<T extends IEntity> |
find(EntitySQL<T> entity,
Where where,
Page page)
根据实体执行SQL分页查询(执行总记录数统计)
|
<T extends IEntity> |
find(EntitySQL<T> entity,
Where where,
Page page,
IShardingable shardingable)
根据实体执行SQL分页查询(执行总记录数统计)
|
<T> IResultSet<T> |
find(SQL sql,
IResultSetHandler<T> handler)
执行SQL查询
|
<T> IResultSet<T> |
find(SQL sql,
IResultSetHandler<T> handler,
Page page)
执行SQL分页查询(执行总记录数统计)
|
<T extends IEntity> |
find(T entity)
根据实体属性值执行查询
|
<T extends IEntity> |
find(T entity,
Fields filter)
根据实体属性值执行查询
|
<T extends IEntity> |
find(T entity,
Fields filter,
IShardingable shardingable)
根据实体属性值执行查询
|
<T extends IEntity> |
find(T entity,
Fields filter,
Page page)
根据实体属性值执行查询
|
<T extends IEntity> |
find(T entity,
Fields filter,
Page page,
IShardingable shardingable)
执行实体属性值分页查询(执行总记录数统计)
|
<T extends IEntity> |
find(T entity,
IShardingable shardingable)
根据实体属性值执行查询
|
<T extends IEntity> |
find(T entity,
Page page)
执行实体属性值分页查询(执行总记录数统计)
|
<T extends IEntity> |
find(T entity,
Page page,
IShardingable shardingable)
执行实体属性值分页查询(执行总记录数统计)
|
<T extends IEntity> |
findFirst(EntitySQL<T> entity)
根据实体执行SQL查询
|
<T extends IEntity> |
findFirst(EntitySQL<T> entity,
IShardingable shardingable)
根据实体执行SQL查询
|
<T extends IEntity> |
findFirst(EntitySQL<T> entity,
Where where)
根据实体执行SQL查询
|
<T extends IEntity> |
findFirst(EntitySQL<T> entity,
Where where,
IShardingable shardingable)
根据实体执行SQL查询
|
<T> T |
findFirst(SQL sql,
IResultSetHandler<T> handler)
执行SQL查询
|
IDatabaseConnectionHolder |
getConnectionHolder()
获取连接对象
|
IDatabase |
getOwner() |
<T extends IEntity> |
insert(List<T> entities)
根据实体执行记录批量插入
|
<T extends IEntity> |
insert(List<T> entities,
Fields filter)
根据实体执行记录批量插入
|
<T extends IEntity> |
insert(ShardingList<T> entities)
根据实体执行记录批量插入
|
<T extends IEntity> |
insert(ShardingList<T> entities,
Fields filter)
根据实体执行记录批量插入
|
<T extends IEntity> |
insert(T entity)
根据实体执行记录插入
|
<T extends IEntity> |
insert(T entity,
Fields filter)
根据实体执行记录插入
|
<T extends IEntity> |
insert(T entity,
Fields filter,
IShardingable shardingable)
根据实体执行记录插入
|
<T extends IEntity> |
insert(T entity,
IShardingable shardingable)
根据实体执行记录插入
|
<T extends IEntity> |
update(List<T> entities,
Fields filter)
根据实体执行SQL批量更新
|
<T extends IEntity> |
update(ShardingList<T> entities,
Fields filter)
根据实体执行SQL批量更新
|
<T extends IEntity> |
update(T entity)
根据实体执行SQL更新
|
<T extends IEntity> |
update(T entity,
Fields filter)
根据实体执行SQL更新
|
<T extends IEntity> |
update(T entity,
Fields filter,
IShardingable shardingable)
根据实体执行SQL更新
|
getId, getSessionEventListener, setSessionEventListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getId, getSessionEventListener, setSessionEventListener
public DefaultDatabaseSession(IDatabase owner) throws Exception
Exception
public DefaultDatabaseSession(IDatabase owner, IDatabaseConnectionHolder connectionHolder)
public IDatabase getOwner()
public IDatabaseConnectionHolder getConnectionHolder()
ISession
getConnectionHolder
in interface ISession<IDatabaseConnectionHolder>
public void close() throws Exception
close
in interface AutoCloseable
Exception
public <T> IResultSet<T> find(SQL sql, IResultSetHandler<T> handler) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型sql
- SQL语句对象handler
- 结果集数据处理器Exception
- 可能产生的异常public <T> IResultSet<T> find(SQL sql, IResultSetHandler<T> handler, Page page) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型sql
- SQL语句对象handler
- 结果集数据处理器page
- 分页参数对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(T entity) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(T entity, IShardingable shardingable) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(T entity, Page page) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体对象page
- 分页参数对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(T entity, Page page, IShardingable shardingable) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体对象page
- 分页参数对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(T entity, Fields filter) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体对象filter
- 过滤字段名称集合Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(T entity, Fields filter, IShardingable shardingable) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体对象filter
- 过滤字段名称集合shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(T entity, Fields filter, Page page) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体对象filter
- 过滤字段名称集合page
- 分页参数对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(T entity, Fields filter, Page page, IShardingable shardingable) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体对象filter
- 过滤字段名称集合page
- 分页参数对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(EntitySQL<T> entity) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(EntitySQL<T> entity, IShardingable shardingable) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(EntitySQL<T> entity, Page page) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象page
- 分页参数对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(EntitySQL<T> entity, Page page, IShardingable shardingable) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象page
- 分页参数对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(EntitySQL<T> entity, Where where) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象where
- 查询条件对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(EntitySQL<T> entity, Where where, IShardingable shardingable) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象where
- 查询条件对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(EntitySQL<T> entity, Where where, Page page) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象where
- 查询条件对象page
- 分页参数对象Exception
- 可能产生的异常public <T extends IEntity> IResultSet<T> find(EntitySQL<T> entity, Where where, Page page, IShardingable shardingable) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象where
- 查询条件对象page
- 分页参数对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> T find(EntitySQL<T> entity, Serializable id) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象id
- 记录IdException
- 可能产生的异常public <T extends IEntity> T find(EntitySQL<T> entity, Serializable id, IShardingable shardingable) throws Exception
IDatabaseSession
find
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象id
- 记录Idshardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T> T findFirst(SQL sql, IResultSetHandler<T> handler) throws Exception
IDatabaseSession
findFirst
in interface IDatabaseSession
T
- 指定结果集数据类型sql
- SQL语句对象handler
- 结果集数据处理器Exception
- 可能产生的异常public <T extends IEntity> T findFirst(EntitySQL<T> entity) throws Exception
IDatabaseSession
findFirst
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象Exception
- 可能产生的异常public <T extends IEntity> T findFirst(EntitySQL<T> entity, IShardingable shardingable) throws Exception
IDatabaseSession
findFirst
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> T findFirst(EntitySQL<T> entity, Where where) throws Exception
IDatabaseSession
findFirst
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象where
- 查询条件对象Exception
- 可能产生的异常public <T extends IEntity> T findFirst(EntitySQL<T> entity, Where where, IShardingable shardingable) throws Exception
IDatabaseSession
findFirst
in interface IDatabaseSession
T
- 指定结果集数据类型entity
- 实体查询对象where
- 查询条件对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public int executeForUpdate(SQL sql) throws Exception
IDatabaseSession
executeForUpdate
in interface IDatabaseSession
sql
- SQL语句对象Exception
- 可能产生的异常public int[] executeForUpdate(BatchSQL sql) throws Exception
IDatabaseSession
executeForUpdate
in interface IDatabaseSession
sql
- 批量SQL更新语句Exception
- 可能产生的异常public <T extends IEntity> T update(T entity) throws Exception
IDatabaseSession
update
in interface IDatabaseSession
T
- 指定实体数据类型entity
- 实体查询对象Exception
- 可能产生的异常public <T extends IEntity> T update(T entity, Fields filter) throws Exception
IDatabaseSession
update
in interface IDatabaseSession
T
- 指定实体数据类型entity
- 实体查询对象filter
- 字段过滤集合Exception
- 可能产生的异常public <T extends IEntity> T update(T entity, Fields filter, IShardingable shardingable) throws Exception
IDatabaseSession
update
in interface IDatabaseSession
T
- 指定实体数据类型entity
- 实体查询对象filter
- 字段过滤集合shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> List<T> update(List<T> entities, Fields filter) throws Exception
IDatabaseSession
update
in interface IDatabaseSession
T
- 指定实体数据类型entities
- 实体查询对象集合filter
- 显示字段过滤集合Exception
- 可能产生的异常public <T extends IEntity> List<T> update(ShardingList<T> entities, Fields filter) throws Exception
IDatabaseSession
update
in interface IDatabaseSession
T
- 指定实体数据类型entities
- 实体查询对象集合filter
- 字段过滤集合Exception
- 可能产生的异常public <T extends IEntity> T insert(T entity) throws Exception
IDatabaseSession
insert
in interface IDatabaseSession
T
- 指定实体数据类型entity
- 实体对象Exception
- 可能产生的异常public <T extends IEntity> T insert(T entity, IShardingable shardingable) throws Exception
IDatabaseSession
insert
in interface IDatabaseSession
T
- 指定实体数据类型entity
- 实体对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> T insert(T entity, Fields filter) throws Exception
IDatabaseSession
insert
in interface IDatabaseSession
T
- 指定实体数据类型entity
- 实体对象filter
- 字段过滤集合Exception
- 可能产生的异常public <T extends IEntity> T insert(T entity, Fields filter, IShardingable shardingable) throws Exception
IDatabaseSession
insert
in interface IDatabaseSession
T
- 指定实体数据类型entity
- 实体对象filter
- 字段过滤集合shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> List<T> insert(List<T> entities) throws Exception
IDatabaseSession
insert
in interface IDatabaseSession
T
- 指定实体数据类型entities
- 实体对象集合Exception
- 可能产生的异常public <T extends IEntity> List<T> insert(ShardingList<T> entities) throws Exception
IDatabaseSession
insert
in interface IDatabaseSession
T
- 指定实体数据类型entities
- 实体对象集合Exception
- 可能产生的异常public <T extends IEntity> List<T> insert(List<T> entities, Fields filter) throws Exception
IDatabaseSession
insert
in interface IDatabaseSession
T
- 指定实体数据类型entities
- 实体对象集合filter
- 字段过滤集合Exception
- 可能产生的异常public <T extends IEntity> List<T> insert(ShardingList<T> entities, Fields filter) throws Exception
IDatabaseSession
insert
in interface IDatabaseSession
T
- 指定实体数据类型entities
- 实体对象集合filter
- 字段过滤集合Exception
- 可能产生的异常public <T extends IEntity> T delete(T entity) throws Exception
IDatabaseSession
delete
in interface IDatabaseSession
T
- 指定实体数据类型entity
- 实体对象Exception
- 可能产生的异常public <T extends IEntity> T delete(T entity, IShardingable shardingable) throws Exception
IDatabaseSession
delete
in interface IDatabaseSession
T
- 指定实体数据类型entity
- 实体对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> int delete(Class<T> entityClass, Serializable id) throws Exception
IDatabaseSession
delete
in interface IDatabaseSession
T
- 指定实体数据类型entityClass
- 实体类对象id
- 记录IdException
- 可能产生的异常public <T extends IEntity> int delete(Class<T> entityClass, Serializable id, IShardingable shardingable) throws Exception
IDatabaseSession
delete
in interface IDatabaseSession
T
- 指定实体数据类型entityClass
- 实体类对象id
- 记录Idshardingable
- 数据分片接口对象Exception
- 可能产生的异常public <T extends IEntity> List<T> delete(List<T> entities) throws Exception
IDatabaseSession
delete
in interface IDatabaseSession
T
- 指定实体数据类型entities
- 实体对象集合Exception
- 可能产生的异常public <T extends IEntity> List<T> delete(ShardingList<T> entities) throws Exception
IDatabaseSession
delete
in interface IDatabaseSession
T
- 指定实体数据类型entities
- 实体对象集合Exception
- 可能产生的异常public <T extends IEntity> int[] delete(Class<T> entityClass, Serializable[] ids) throws Exception
IDatabaseSession
delete
in interface IDatabaseSession
T
- 指定实体数据类型entityClass
- 实体类对象ids
- 记录Id集合Exception
- 可能产生的异常public <T extends IEntity> int[] delete(Class<T> entityClass, ShardingList<Serializable> ids) throws Exception
IDatabaseSession
delete
in interface IDatabaseSession
T
- 指定实体数据类型entityClass
- 实体类对象ids
- 记录Id集合Exception
- 可能产生的异常public <T extends IEntity> long count(Class<T> entityClass, Where where) throws Exception
IDatabaseSession
count
in interface IDatabaseSession
T
- 指定实体类型entityClass
- 实体类对象where
- 查询条件对象Exception
- 可能产生的异常public <T extends IEntity> long count(Class<T> entityClass) throws Exception
IDatabaseSession
count
in interface IDatabaseSession
T
- 指定实体数据类型entityClass
- 实体类对象Exception
- 可能产生的异常public <T extends IEntity> long count(Class<T> entityClass, Where where, IShardingable shardingable) throws Exception
IDatabaseSession
count
in interface IDatabaseSession
T
- 指定实体数据类型entityClass
- 实体类对象where
- 查询条件对象shardingable
- 数据分片接口对象Exception
- 可能产生的异常public long count(SQL sql) throws Exception
IDatabaseSession
count
in interface IDatabaseSession
sql
- SQL语句对象Exception
- 可能产生的异常Copyright © 2022. All rights reserved.