public class RelationalDao<T> extends Object implements ShardedDao<T>
| Constructor and Description |
|---|
RelationalDao(List<org.hibernate.SessionFactory> sessionFactories,
Class<T> entityClass,
ShardCalculator<String> shardCalculator)
Create a relational DAO.
|
| Modifier and Type | Method and Description |
|---|---|
long |
count(String parentKey,
org.hibernate.criterion.DetachedCriteria criteria) |
boolean |
exists(String parentKey,
Object key) |
Optional<T> |
get(String parentKey,
Object key) |
<U> U |
get(String parentKey,
Object key,
Function<T,U> function) |
protected Field |
getKeyField() |
<U> U |
runInSession(String id,
Function<org.hibernate.Session,U> handler) |
Optional<T> |
save(String parentKey,
T entity) |
<U> U |
save(String parentKey,
T entity,
Function<T,U> handler) |
boolean |
saveAll(String parentKey,
Collection<T> entities) |
List<T> |
scatterGather(org.hibernate.criterion.DetachedCriteria criteria,
int start,
int numRows) |
List<T> |
select(String parentKey,
org.hibernate.criterion.DetachedCriteria criteria,
int first,
int numResults) |
<U> U |
select(String parentKey,
org.hibernate.criterion.DetachedCriteria criteria,
int first,
int numResults,
Function<List<T>,U> handler) |
boolean |
update(String parentKey,
org.hibernate.criterion.DetachedCriteria criteria,
Function<T,T> updater) |
boolean |
update(String parentKey,
Object id,
Function<T,T> updater) |
boolean |
updateAll(String parentKey,
int start,
int numRows,
org.hibernate.criterion.DetachedCriteria criteria,
Function<T,T> updater) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetShardCalculatorpublic RelationalDao(List<org.hibernate.SessionFactory> sessionFactories, Class<T> entityClass, ShardCalculator<String> shardCalculator)
sessionFactories - List of session factories. One for each shard.entityClass - The class for which the dao will be used.shardCalculator - public boolean saveAll(String parentKey, Collection<T> entities)
public boolean update(String parentKey, org.hibernate.criterion.DetachedCriteria criteria, Function<T,T> updater)
public boolean updateAll(String parentKey, int start, int numRows, org.hibernate.criterion.DetachedCriteria criteria, Function<T,T> updater)
public List<T> select(String parentKey, org.hibernate.criterion.DetachedCriteria criteria, int first, int numResults) throws Exception
Exceptionpublic <U> U select(String parentKey, org.hibernate.criterion.DetachedCriteria criteria, int first, int numResults, Function<List<T>,U> handler) throws Exception
Exceptionpublic long count(String parentKey, org.hibernate.criterion.DetachedCriteria criteria)
public List<T> scatterGather(org.hibernate.criterion.DetachedCriteria criteria, int start, int numRows)
protected Field getKeyField()
Copyright © 2016–2020. All rights reserved.