Class GenericDAOJPAImpl<E,I extends Serializable>
java.lang.Object
org.exoplatform.commons.persistence.impl.GenericDAOJPAImpl<E,I>
- All Implemented Interfaces:
org.exoplatform.commons.api.persistence.GenericDAO<E,I>
- Direct Known Subclasses:
SettingContextDAO,SettingScopeDAO,SettingsDAO
public class GenericDAOJPAImpl<E,I extends Serializable>
extends Object
implements org.exoplatform.commons.api.persistence.GenericDAO<E,I>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncount()voidvoidvoidvoidfindAll()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 jakarta.persistence.EntityManagerReturn an EntityManager instance.protected org.hibernate.dialect.Dialectprotected booleanprotected booleanvoid
-
Field Details
-
modelClass
-
-
Constructor Details
-
GenericDAOJPAImpl
public GenericDAOJPAImpl()
-
-
Method Details
-
count
- Specified by:
countin interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
find
- Specified by:
findin interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
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. This will result in a org.hibernate.SessionException: Session is closed!. Thus, this method shall always be invoked with an EntityManager in the ThreadLocal (for example, from a request managed by the portal lifecycle or from a method annotated with @ExoTransactional)- Specified by:
findAllin interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
create
- Specified by:
createin interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
createAll
- Specified by:
createAllin interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
update
- Specified by:
updatein interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
updateAll
- Specified by:
updateAllin interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
delete
- Specified by:
deletein interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
deleteAll
- Specified by:
deleteAllin interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
deleteAll
public void deleteAll()- Specified by:
deleteAllin interfaceorg.exoplatform.commons.api.persistence.GenericDAO<E,I extends Serializable>
-
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager()Return an EntityManager instance.- Returns:
- An EntityManger instance.
-
getHibernateDialect
protected org.hibernate.dialect.Dialect getHibernateDialect() -
isMSSQLDialect
protected boolean isMSSQLDialect() -
isOrcaleDialect
protected boolean isOrcaleDialect()
-