## net.dontdrinkandroot.persistence.dao
Class AbstractJpaDao<T extends Entity<K>,K>

    java.lang.Object
      net.dontdrinkandroot.persistence.dao.AbstractJpaDao<T,K>

All Implemented Interfaces:
  Dao<T,K>

    public class AbstractJpaDao<T extends Entity<K>,K>

extends java.lang.Object
implements Dao<T,K>

Field Summary
`protected java.lang.Class<T>` `entityClass`
`protected org.slf4j.Logger` `logger`

Constructor Summary
`AbstractJpaDao(java.lang.Class<T> entityClass)`

Method Summary
`protected java.util.Iterator<T>` `createIterator(javax.persistence.TypedQuery<T> query, int pageSize)`
`void` `delete(K id)`
`void` `delete(T entity)`

`protected

`<V> java.util.List<V>`

`

`find(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery)`

`protected

`<V> java.util.List<V>`

`

`find(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery, int maxResults)`

`protected

`<V> java.util.List<V>`

`

`find(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery, int firstResult, int maxResults)`

`T` `find(K id)`
`java.util.List<T>` `findAll()`
`java.util.List<T>` `findAll(AbstractFilter<T>... filters)`
`java.util.List<T>` `findAll(AbstractFilter<T> filter)`
`java.util.List<T>` `findAll(java.util.Collection<AbstractFilter<T>> filters)`
`java.util.List<T>` `findAll(javax.persistence.metamodel.SingularAttribute<? super T,?> attribute, boolean asc)`

`

`<V> T`

`

`findByAttribute(javax.persistence.metamodel.SingularAttribute<? super T,V> attribute, V value)`

`protected

`<V> V`

`

`findSingle(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery)`

`protected

`<V> V`

`

`findSingleOrNull(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery)`

`java.util.List<T>` `findSorted(javax.persistence.metamodel.SingularAttribute<? super T,?> attribute, boolean asc, int firstResult, int maxResults)`
`long` `getCount()` Get the total number of entities in this Dao.
`protected javax.persistence.criteria.CriteriaBuilder` `getCriteriaBuilder()`
`javax.persistence.EntityManager` `getEntityManager()`
`T` `load(K id)`
`T` `save(T entity)`
`void` `setEntityManager(javax.persistence.EntityManager entityManager)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### entityClass

    protected java.lang.Class<T extends Entity<K>> entityClass

### logger

    protected final org.slf4j.Logger logger

Constructor Detail

### AbstractJpaDao

    public AbstractJpaDao(java.lang.Class<T> entityClass)

Method Detail

### setEntityManager

    public void setEntityManager(javax.persistence.EntityManager entityManager)

### getEntityManager

    public javax.persistence.EntityManager getEntityManager()

### delete

    @Transactional
    public void delete(T entity)

  Specified by:
    `delete` in interface `Dao<T extends Entity<K>,K>`

### delete

    @Transactional
    public void delete(K id)

  Specified by:
    `delete` in interface `Dao<T extends Entity<K>,K>`

### find

    @Transactional(readOnly=true)
    public T find(K id)

  Specified by:
    `find` in interface `Dao<T extends Entity<K>,K>`

### getCount

    @Transactional(readOnly=true)
    public long getCount()

  Description copied from interface: `Dao`
  Get the total number of entities in this Dao.

  Specified by:
    `getCount` in interface `Dao<T extends Entity<K>,K>`

### findByAttribute

    @Transactional(readOnly=true)
    public <V> T findByAttribute(javax.persistence.metamodel.SingularAttribute<? super T,V> attribute,
                                               V value)

  Specified by:
    `findByAttribute` in interface `Dao<T extends Entity<K>,K>`

### load

    @Transactional(readOnly=true)
    public T load(K id)

  Specified by:
    `load` in interface `Dao<T extends Entity<K>,K>`

### save

    @Transactional
    public T save(T entity)

  Specified by:
    `save` in interface `Dao<T extends Entity<K>,K>`

### findAll

    @Transactional(readOnly=true)
    public java.util.List<T> findAll()

  Specified by:
    `findAll` in interface `Dao<T extends Entity<K>,K>`

### findAll

    @Transactional(readOnly=true)
    public java.util.List<T> findAll(javax.persistence.metamodel.SingularAttribute<? super T,?> attribute,
                                                   boolean asc)

  Specified by:
    `findAll` in interface `Dao<T extends Entity<K>,K>`

### findSorted

    @Transactional(readOnly=true)
    public java.util.List<T> findSorted(javax.persistence.metamodel.SingularAttribute<? super T,?> attribute,
                                                      boolean asc,
                                                      int firstResult,
                                                      int maxResults)

  Specified by:
    `findSorted` in interface `Dao<T extends Entity<K>,K>`

### findAll

    @Transactional(readOnly=true)
    public java.util.List<T> findAll(AbstractFilter<T> filter)

  Specified by:
    `findAll` in interface `Dao<T extends Entity<K>,K>`

### findAll

    @Transactional(readOnly=true)
    public java.util.List<T> findAll(java.util.Collection<AbstractFilter<T>> filters)

  Specified by:
    `findAll` in interface `Dao<T extends Entity<K>,K>`

### findAll

    @Transactional(readOnly=true)
    public java.util.List<T> findAll(AbstractFilter<T>... filters)

  Specified by:
    `findAll` in interface `Dao<T extends Entity<K>,K>`

### find

    protected <V> java.util.List<V> find(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery)

### find

    protected <V> java.util.List<V> find(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery,
                                         int firstResult,
                                         int maxResults)

### find

    protected <V> java.util.List<V> find(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery,
                                         int maxResults)

### findSingle

    protected <V> V findSingle(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery)

### findSingleOrNull

    protected <V> V findSingleOrNull(javax.persistence.criteria.CriteriaQuery<V> criteriaQuery)

### getCriteriaBuilder

    protected javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()

### createIterator

    protected java.util.Iterator<T> createIterator(javax.persistence.TypedQuery<T> query,
                                                   int pageSize)

Copyright © 2013 dontdrinkandroot. All Rights Reserved.