E - the managed entity typepublic abstract class AbstractTopiaDao<E extends TopiaEntity> extends Object implements TopiaDao<E>
TopiaJpaSupport.
This class is directly extended by the GeneratedXyzTopiaDao which groups all the Xyz specific methods.
Instances are created bt the model's specific TopiaPersistenceContext, which implements the
TopiaDaoSupplier contract.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractTopiaDao.FindAllIterator<E extends TopiaEntity,K> |
static class |
AbstractTopiaDao.InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep<E extends TopiaEntity> |
static class |
AbstractTopiaDao.InnerTopiaQueryBuilderRunQueryStep<E extends TopiaEntity> |
| Modifier and Type | Field and Description |
|---|---|
protected int |
batchSize
Default batch size used to iterate on data.
|
protected TopiaDaoSupplier |
topiaDaoSupplier |
protected TopiaFiresSupport |
topiaFiresSupport |
protected TopiaIdFactory |
topiaIdFactory |
protected TopiaJpaSupport |
topiaJpaSupport |
protected TopiaListenableSupport |
topiaListenableSupport |
protected TopiaSqlSupport |
topiaSqlSupport |
| Constructor and Description |
|---|
AbstractTopiaDao() |
| Modifier and Type | Method and Description |
|---|---|
void |
addTopiaEntityListener(TopiaEntityListener listener) |
void |
addTopiaEntityVetoable(TopiaEntityVetoable vetoable) |
long |
count()
Count the number of existing entities.
|
protected long |
count(String hql,
Map<String,Object> hqlParameters) |
E |
create() |
E |
create(E entity)
Creates an entity not created without the DAO using any of the others
create methods.
|
E |
create(Map<String,Object> properties)
Creates a new instance of the entity managed by the DAO
|
E |
create(String propertyName,
Object propertyValue,
Object... otherPropertyNamesAndValues) |
Iterable<E> |
createAll(Iterable<E> entities) |
void |
delete(E entity)
Deletes the given entity from the storage
|
void |
deleteAll(Iterable<E> entities)
Deletes all given entities from the storage
|
protected boolean |
exists(String hql,
Map<String,Object> hqlParameters) |
protected <K> List<K> |
find(String hql,
Map<String,Object> hqlParameters,
int startIndex,
int endIndex) |
<K> List<K> |
find(String hql,
Map<String,Object> hqlParameters,
TopiaPagerBean pager) |
List<E> |
findAll()
Finds all the entities managed by this DAO.
|
protected <K> List<K> |
findAll(String hql,
Map<String,Object> hqlParameters) |
List<String> |
findAllIds()
Find all the ids for the entities managed by this DAO.
|
Iterable<E> |
findAllLazy() |
protected <K> Iterable<K> |
findAllLazy(String hql,
Map<String,Object> hqlParameters) |
protected <K> Iterable<K> |
findAllLazy(String hql,
Map<String,Object> hqlParameters,
int batchSize) |
protected <K> K |
findAny(String hql,
Map<String,Object> hqlParameters) |
protected <K> K |
findAnyOrNull(String hql,
Map<String,Object> hqlParameters) |
E |
findByTopiaId(String topiaId)
Tries to find the entity with the given topiaId.
|
protected <K> K |
findFirst(String hql,
Map<String,Object> hqlParameters) |
protected <K> K |
findFirstOrNull(String hql,
Map<String,Object> hqlParameters) |
protected <K> K |
findUnique(String hql,
Map<String,Object> hqlParameters) |
protected <K> K |
findUniqueOrNull(String hql,
Map<String,Object> hqlParameters) |
TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> |
forContains(String propertyName,
Object propertyValue) |
TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> |
forEquals(String propertyName,
Object propertyValue) |
protected AbstractTopiaDao.InnerTopiaQueryBuilderRunQueryStep<E> |
forHql(String hql) |
protected AbstractTopiaDao.InnerTopiaQueryBuilderRunQueryStep<E> |
forHql(String hql,
Map<String,Object> hqlParameters) |
protected AbstractTopiaDao.InnerTopiaQueryBuilderRunQueryStep<E> |
forHql(String hql,
String parameterName,
Object parameterValue,
Object... otherParameterNamesAndValues) |
TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> |
forIn(String propertyName,
Collection<?> propertyValues) |
AbstractTopiaDao.InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep<E> |
forProperties(Map<String,Object> properties) |
AbstractTopiaDao.InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep<E> |
forProperties(String propertyName,
Object propertyValue,
Object... otherPropertyNamesAndValues) |
TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> |
forTopiaIdEquals(String topiaId) |
TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> |
forTopiaIdIn(Collection<String> topiaIds) |
int |
getBatchSize()
Obtains the batch size used to load data.
|
abstract Class<E> |
getEntityClass()
Return the class of the entity managed by this DAO.
|
protected HqlAndParametersBuilder<E> |
getHqlForNoConstraint() |
protected HqlAndParametersBuilder<E> |
getHqlForProperties(Map<String,Object> properties) |
protected HqlAndParametersBuilder<E> |
getHqlForProperties(String propertyName,
Object propertyValue,
Object... otherPropertyNamesAndValues) |
abstract TopiaEntityEnum |
getTopiaEntityEnum() |
TopiaFiresSupport |
getTopiaFiresSupport() |
protected boolean |
hqlContainsCount(String hql) |
protected boolean |
hqlContainsOrderBy(String hql) |
void |
init(TopiaJpaSupport topiaJpaSupport,
TopiaSqlSupport topiaSqlSupport,
TopiaListenableSupport topiaListenableSupport,
TopiaIdFactory topiaIdFactory,
TopiaFiresSupport topiaFiresSupport,
TopiaDaoSupplier topiaDaoSupplier)
When AbstractTopiaContext create the TopiaDAOHibernate, it must call this
method just after.
|
Iterator<E> |
iterator() |
protected String |
newFromClause() |
protected String |
newFromClause(String alias) |
protected HqlAndParametersBuilder<E> |
newHqlAndParametersBuilder() |
E |
newInstance()
Create a new instance of managed entity not persisted.
|
TopiaPagerBean |
newPager(int pageSize)
Creates a new pager initialized for the first page of all data of the dao.
|
TopiaPagerBean |
newPager(String hql,
Map<String,Object> params,
int pageSize)
Creates a new pager initialized for the first page of data of the given
query.
|
AbstractTopiaDao.InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep<E> |
newQueryBuilder() |
void |
removeTopiaEntityListener(TopiaEntityListener listener) |
void |
removeTopiaEntityVetoable(TopiaEntityVetoable vetoable) |
void |
setBatchSize(int batchSize)
Set a new default batch size.
|
protected <K> com.google.common.base.Optional<K> |
tryFindAny(String hql,
Map<String,Object> hqlParameters) |
com.google.common.base.Optional<E> |
tryFindByTopiaId(String topiaId)
Tries to find the entity with the given topiaId.
|
protected <K> com.google.common.base.Optional<K> |
tryFindFirst(String hql,
Map<String,Object> hqlParameters) |
protected <K> com.google.common.base.Optional<K> |
tryFindUnique(String hql,
Map<String,Object> hqlParameters) |
E |
update(E entity)
Update an entity.
|
Iterable<E> |
updateAll(Iterable<E> entities) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindAllUsages, findUsages, getAggregate, getCompositeprotected int batchSize
protected TopiaJpaSupport topiaJpaSupport
protected TopiaSqlSupport topiaSqlSupport
protected TopiaListenableSupport topiaListenableSupport
protected TopiaIdFactory topiaIdFactory
protected TopiaFiresSupport topiaFiresSupport
protected TopiaDaoSupplier topiaDaoSupplier
public abstract TopiaEntityEnum getTopiaEntityEnum()
public abstract Class<E> getEntityClass()
TopiaDaogetEntityClass in interface TopiaDao<E extends TopiaEntity>public void init(TopiaJpaSupport topiaJpaSupport, TopiaSqlSupport topiaSqlSupport, TopiaListenableSupport topiaListenableSupport, TopiaIdFactory topiaIdFactory, TopiaFiresSupport topiaFiresSupport, TopiaDaoSupplier topiaDaoSupplier)
public TopiaFiresSupport getTopiaFiresSupport()
public int getBatchSize()
TopiaDaogetBatchSize in interface TopiaDao<E extends TopiaEntity>public void setBatchSize(int batchSize)
TopiaDaosetBatchSize in interface TopiaDao<E extends TopiaEntity>batchSize - new batch size to use when iterating.protected String newFromClause()
public E newInstance()
TopiaDaonewInstance in interface TopiaDao<E extends TopiaEntity>public TopiaPagerBean newPager(int pageSize)
TopiaDaonewPager in interface TopiaDao<E extends TopiaEntity>pageSize - size of a pagepublic TopiaPagerBean newPager(String hql, Map<String,Object> params, int pageSize)
TopiaDaonewPager in interface TopiaDao<E extends TopiaEntity>hql - queryparams - params of the querypageSize - size of a pagepublic void addTopiaEntityListener(TopiaEntityListener listener)
addTopiaEntityListener in interface TopiaDao<E extends TopiaEntity>public void addTopiaEntityVetoable(TopiaEntityVetoable vetoable)
addTopiaEntityVetoable in interface TopiaDao<E extends TopiaEntity>public void removeTopiaEntityListener(TopiaEntityListener listener)
removeTopiaEntityListener in interface TopiaDao<E extends TopiaEntity>public void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable)
removeTopiaEntityVetoable in interface TopiaDao<E extends TopiaEntity>public E create(E entity)
TopiaDaocreate in interface TopiaDao<E extends TopiaEntity>entity - the instance to persistpublic E create(String propertyName, Object propertyValue, Object... otherPropertyNamesAndValues)
create in interface TopiaDao<E extends TopiaEntity>public E create(Map<String,Object> properties)
TopiaDaocreate in interface TopiaDao<E extends TopiaEntity>properties - the key-value list of properties that the created entity will have.public E create()
create in interface TopiaDao<E extends TopiaEntity>public Iterable<E> createAll(Iterable<E> entities)
createAll in interface TopiaDao<E extends TopiaEntity>public E update(E entity)
TopiaDaoupdate in interface TopiaDao<E extends TopiaEntity>entity - the entity to create or updatepublic Iterable<E> updateAll(Iterable<E> entities)
updateAll in interface TopiaDao<E extends TopiaEntity>public void delete(E entity)
TopiaDaodelete in interface TopiaDao<E extends TopiaEntity>entity - the entity to removepublic void deleteAll(Iterable<E> entities)
TopiaDaodeleteAll in interface TopiaDao<E extends TopiaEntity>entities - entities to deleteprotected HqlAndParametersBuilder<E> newHqlAndParametersBuilder()
protected HqlAndParametersBuilder<E> getHqlForProperties(String propertyName, Object propertyValue, Object... otherPropertyNamesAndValues)
protected HqlAndParametersBuilder<E> getHqlForNoConstraint()
protected HqlAndParametersBuilder<E> getHqlForProperties(Map<String,Object> properties)
protected AbstractTopiaDao.InnerTopiaQueryBuilderRunQueryStep<E> forHql(String hql)
protected AbstractTopiaDao.InnerTopiaQueryBuilderRunQueryStep<E> forHql(String hql, Map<String,Object> hqlParameters)
protected AbstractTopiaDao.InnerTopiaQueryBuilderRunQueryStep<E> forHql(String hql, String parameterName, Object parameterValue, Object... otherParameterNamesAndValues)
public AbstractTopiaDao.InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep<E> forProperties(Map<String,Object> properties)
forProperties in interface TopiaDao<E extends TopiaEntity>public AbstractTopiaDao.InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep<E> forProperties(String propertyName, Object propertyValue, Object... otherPropertyNamesAndValues)
forProperties in interface TopiaDao<E extends TopiaEntity>public AbstractTopiaDao.InnerTopiaQueryBuilderAddCriteriaOrRunQueryStep<E> newQueryBuilder()
newQueryBuilder in interface TopiaDao<E extends TopiaEntity>public TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> forContains(String propertyName, Object propertyValue)
forContains in interface TopiaDao<E extends TopiaEntity>public TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> forEquals(String propertyName, Object propertyValue)
forEquals in interface TopiaDao<E extends TopiaEntity>public TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> forIn(String propertyName, Collection<?> propertyValues)
forIn in interface TopiaDao<E extends TopiaEntity>protected <K> K findUnique(String hql, Map<String,Object> hqlParameters) throws TopiaNoResultException, TopiaNonUniqueResultException
protected <K> com.google.common.base.Optional<K> tryFindUnique(String hql, Map<String,Object> hqlParameters) throws TopiaNonUniqueResultException
TopiaNonUniqueResultExceptionprotected <K> K findUniqueOrNull(String hql, Map<String,Object> hqlParameters) throws TopiaNonUniqueResultException
TopiaNonUniqueResultExceptionprotected <K> K findFirst(String hql, Map<String,Object> hqlParameters) throws QueryMissingOrderException
QueryMissingOrderExceptionprotected <K> com.google.common.base.Optional<K> tryFindFirst(String hql, Map<String,Object> hqlParameters) throws QueryMissingOrderException
QueryMissingOrderExceptionprotected <K> K findFirstOrNull(String hql, Map<String,Object> hqlParameters) throws QueryMissingOrderException
QueryMissingOrderExceptionprotected <K> K findAny(String hql, Map<String,Object> hqlParameters) throws TopiaNoResultException
TopiaNoResultExceptionprotected <K> com.google.common.base.Optional<K> tryFindAny(String hql, Map<String,Object> hqlParameters)
protected <K> List<K> find(String hql, Map<String,Object> hqlParameters, int startIndex, int endIndex)
protected <K> Iterable<K> findAllLazy(String hql, Map<String,Object> hqlParameters, int batchSize)
public TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> forTopiaIdEquals(String topiaId)
forTopiaIdEquals in interface TopiaDao<E extends TopiaEntity>public TopiaQueryBuilderAddCriteriaOrRunQueryStep<E> forTopiaIdIn(Collection<String> topiaIds)
forTopiaIdIn in interface TopiaDao<E extends TopiaEntity>public E findByTopiaId(String topiaId) throws TopiaNoResultException
TopiaDaofindByTopiaId in interface TopiaDao<E extends TopiaEntity>topiaId - the identifier of the entity to look forTopiaNoResultException - if result is found, if you
do not want an exception to be raised, use
TopiaDao.tryFindByTopiaId(String)public com.google.common.base.Optional<E> tryFindByTopiaId(String topiaId)
TopiaDaofalse.tryFindByTopiaId in interface TopiaDao<E extends TopiaEntity>topiaId - the identifier of the entity to look forpublic List<String> findAllIds()
TopiaDaofindAllIds in interface TopiaDao<E extends TopiaEntity>public List<E> findAll()
TopiaDaofindAll in interface TopiaDao<E extends TopiaEntity>public Iterable<E> findAllLazy()
findAllLazy in interface TopiaDao<E extends TopiaEntity>public Iterator<E> iterator()
iterator in interface Iterable<E extends TopiaEntity>public long count()
TopiaDaocount in interface TopiaDao<E extends TopiaEntity>protected boolean hqlContainsOrderBy(String hql)
protected boolean hqlContainsCount(String hql)
Copyright © 2004–2014 CodeLutin. All rights reserved.