E - Entity typeID - Identity of the entitypublic class GenericDAOJPAImpl<E,ID extends Serializable> extends Object implements org.exoplatform.commons.api.persistence.GenericDAO<E,ID>
| Modifier and Type | Field and Description |
|---|---|
protected Class<E> |
modelClass |
| Constructor and Description |
|---|
GenericDAOJPAImpl() |
| Modifier and Type | Method and Description |
|---|---|
Long |
count() |
E |
create(E entity) |
void |
createAll(List<E> entities) |
void |
delete(E entity) |
void |
deleteAll() |
void |
deleteAll(List<E> entities) |
E |
find(ID id) |
List<E> |
findAll()
This method makes 2 calls to getEntityManager():
1- The first one to get the CriteriaBuilder
2- The second one to create the query
If there is no EntityManager in the threadLocal (i.e: EntityManagerService.getEntityManager() returns null),
the EntityManagerHolder will return 2 distinct EntityManager instances.
|
protected javax.persistence.EntityManager |
getEntityManager()
Return an EntityManager instance.
|
E |
update(E entity) |
void |
updateAll(List<E> entities) |
public Long count()
count in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>public E find(ID id)
find in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>public List<E> findAll()
findAll in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>public E create(E entity)
create in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>public void createAll(List<E> entities)
createAll in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>public E update(E entity)
update in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>public void updateAll(List<E> entities)
updateAll in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>public void delete(E entity)
delete in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>public void deleteAll(List<E> entities)
deleteAll in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>public void deleteAll()
deleteAll in interface org.exoplatform.commons.api.persistence.GenericDAO<E,ID extends Serializable>protected javax.persistence.EntityManager getEntityManager()
Copyright © 2003–2016 eXo Platform SAS. All rights reserved.