|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.synyx.hades.dao.orm.GenericDaoSupport<T>
org.synyx.hades.dao.orm.GenericJpaDao<T,PK>
T - the type of the entity to handlePK - the type of the entity's identifier@Repository @Transactional public class GenericJpaDao<T,PK extends java.io.Serializable>
Default implementation of the GenericDao interface. This will offer
you a more sophisticated interface than the plain EntityManager.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.synyx.hades.dao.orm.GenericDaoSupport |
|---|
GenericDaoSupport.IdAware, GenericDaoSupport.IsNewAware, GenericDaoSupport.PersistableEntityInformation, GenericDaoSupport.ReflectiveEntityInformation |
| Constructor Summary | |
|---|---|
GenericJpaDao()
|
|
| Method Summary | ||
|---|---|---|
java.lang.Long |
count()
Returns the number of entities available. |
|
static
|
create(javax.persistence.EntityManager entityManager,
java.lang.Class<T> domainClass)
Factory method to create GenericJpaDao instances. |
|
void |
delete(java.util.Collection<? extends T> entities)
Deletes the given entities. |
|
void |
delete(T entity)
Deletes a given entity. |
|
void |
deleteAll()
Deletes all entities managed by the DAO. |
|
boolean |
exists(PK primaryKey)
Returns whether an entity with the given id exists. |
|
void |
flush()
Flushes all pending changes to the database. |
|
java.util.List<T> |
readAll()
Returns all instances of the type. |
|
Page<T> |
readAll(Pageable pageable)
Returns a paged list of entities meeting the paging restriction provided in the Pageable object. |
|
java.util.List<T> |
readAll(Sort sort)
Returns all entities sorted by the given options. |
|
java.util.List<T> |
readAll(Specification<T> spec)
Returns all entities matching the given Specification. |
|
Page<T> |
readAll(Specification<T> spec,
Pageable pageable)
Returns a Page of entities matching the given
Specification. |
|
T |
readByPrimaryKey(PK primaryKey)
Retrives an entity by it's primary key. |
|
protected Page<T> |
readPage(Pageable pageable,
java.lang.String query)
Reads a page of entities for the given JPQL query. |
|
java.util.List<T> |
save(java.util.Collection<? extends T> entities)
|
|
T |
save(T entity)
Saves a given entity. |
|
T |
saveAndFlush(T entity)
Saves an entity and flushes changes instantly to the database. |
|
| Methods inherited from class org.synyx.hades.dao.orm.GenericDaoSupport |
|---|
assertEntityManagerClass, createIsNewStrategy, getCountQueryString, getDeleteAllQueryString, getDomainClass, getEntityManager, getIsNewStrategy, getReadAllQuery, getReadAllQueryString, setDomainClass, setEntityManager, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GenericJpaDao()
| Method Detail |
|---|
public static <T,PK extends java.io.Serializable> GenericDao<T,PK> create(javax.persistence.EntityManager entityManager,
java.lang.Class<T> domainClass)
GenericJpaDao instances.
T - the type of the entity to handlePK - the type of the entity's identifierentityManager - the EntityManager backing the DAOdomainClass - the domain class to handle
public void delete(T entity)
GenericDao
delete in interface GenericDao<T,PK extends java.io.Serializable>public void delete(java.util.Collection<? extends T> entities)
GenericDao
delete in interface GenericDao<T,PK extends java.io.Serializable>public void deleteAll()
GenericDao
deleteAll in interface GenericDao<T,PK extends java.io.Serializable>@Transactional(readOnly=true) public T readByPrimaryKey(PK primaryKey)
GenericDao
readByPrimaryKey in interface GenericDao<T,PK extends java.io.Serializable>null if none
found@Transactional(readOnly=true) public boolean exists(PK primaryKey)
GenericDao
exists in interface GenericDao<T,PK extends java.io.Serializable>@Transactional(readOnly=true) public java.util.List<T> readAll()
GenericDao
readAll in interface GenericDao<T,PK extends java.io.Serializable>@Transactional(readOnly=true) public java.util.List<T> readAll(Specification<T> spec)
GenericDaoSpecification.
readAll in interface GenericDao<T,PK extends java.io.Serializable>
@Transactional(readOnly=true)
public Page<T> readAll(Specification<T> spec,
Pageable pageable)
GenericDaoPage of entities matching the given
Specification.
readAll in interface GenericDao<T,PK extends java.io.Serializable>@Transactional(readOnly=true) public java.util.List<T> readAll(Sort sort)
GenericDao
readAll in interface GenericDao<T,PK extends java.io.Serializable>@Transactional(readOnly=true) public Page<T> readAll(Pageable pageable)
GenericDaoPageable object.
readAll in interface GenericDao<T,PK extends java.io.Serializable>@Transactional(readOnly=true) public java.lang.Long count()
GenericDao
count in interface GenericDao<T,PK extends java.io.Serializable>public T save(T entity)
GenericDao
save in interface GenericDao<T,PK extends java.io.Serializable>public T saveAndFlush(T entity)
GenericDao
saveAndFlush in interface GenericDao<T,PK extends java.io.Serializable>public java.util.List<T> save(java.util.Collection<? extends T> entities)
save in interface GenericDao<T,PK extends java.io.Serializable>public void flush()
GenericDao
flush in interface GenericDao<T,PK extends java.io.Serializable>
protected Page<T> readPage(Pageable pageable,
java.lang.String query)
pageable - query -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||