Package org.broadleafcommerce.common.dao
Class GenericEntityDaoImpl
java.lang.Object
org.broadleafcommerce.common.dao.GenericEntityDaoImpl
- All Implemented Interfaces:
GenericEntityDao
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
@Repository("blGenericEntityDao")
public class GenericEntityDaoImpl
extends Object
implements GenericEntityDao, org.springframework.context.ApplicationContextAware
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DynamicDaoHelperImpl
protected jakarta.persistence.EntityManager
protected EntityConfiguration
protected PersistenceService
protected StreamingTransactionCapableUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear level 1 cachevoid
void
void
flush()
Flush changes to the persistence storeClass<?>
getCeilingImplClass
(String className) Finds the ceiling implementation for the entityjakarta.persistence.EntityManager
Gathers theEntityManager
that is based on blPUprotected jakarta.persistence.EntityManager
getEntityManager
(Class clazz) static GenericEntityDaoImpl
getIdentifier
(Object entity) Retrieve the identifier from the Hibernate entity (the entity must reside in the current session)protected Field
getIdField
(Class<?> clazz) Class<?>
getImplClass
(String className) For a given className, finds the parent implementation class as defined in theEntityConfiguration
boolean
idAssigned
(Object object) Whether or not this object is anEntity
and whether or not it already has an id assignedvoid
Persist the new entity<T> List<T>
readAllGenericEntity
(Class<T> clazz) <T> List<T>
readAllGenericEntity
(Class<T> clazz, int limit, int offset) Finds all generic entities for a given classname, with pagination options.readAllGenericEntityId
(Class<?> clazz) <T> Long
readCountGenericEntity
(Class<T> clazz) Finds how many of the given entity class are persisted<T> T
readGenericEntity
(Class<T> clazz, Object id) Finds a generic entity by a classname and idvoid
Remove the entity<T> T
save
(T object) Saves a generic entityboolean
sessionContains
(Object object) Whether or not the current hibernate session (level 1) contains the objectvoid
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext)
-
Field Details
-
em
protected jakarta.persistence.EntityManager em -
persistenceService
-
entityConfiguration
-
transactionUtil
-
daoHelper
-
-
Constructor Details
-
GenericEntityDaoImpl
public GenericEntityDaoImpl()
-
-
Method Details
-
getGenericEntityDao
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
readGenericEntity
Description copied from interface:GenericEntityDao
Finds a generic entity by a classname and id- Specified by:
readGenericEntity
in interfaceGenericEntityDao
- Returns:
- the entity
-
readCountGenericEntity
Description copied from interface:GenericEntityDao
Finds how many of the given entity class are persisted- Specified by:
readCountGenericEntity
in interfaceGenericEntityDao
- Returns:
- the count of the generic entity
-
readAllGenericEntity
Description copied from interface:GenericEntityDao
Finds all generic entities for a given classname, with pagination options.- Specified by:
readAllGenericEntity
in interfaceGenericEntityDao
- Returns:
- the entities
-
readAllGenericEntity
- Specified by:
readAllGenericEntity
in interfaceGenericEntityDao
-
readAllGenericEntityId
- Specified by:
readAllGenericEntityId
in interfaceGenericEntityDao
-
getImplClass
Description copied from interface:GenericEntityDao
For a given className, finds the parent implementation class as defined in theEntityConfiguration
- Specified by:
getImplClass
in interfaceGenericEntityDao
- Returns:
- the impl class object
-
getCeilingImplClass
Description copied from interface:GenericEntityDao
Finds the ceiling implementation for the entity- Specified by:
getCeilingImplClass
in interfaceGenericEntityDao
- Returns:
-
getIdentifier
Description copied from interface:GenericEntityDao
Retrieve the identifier from the Hibernate entity (the entity must reside in the current session)- Specified by:
getIdentifier
in interfaceGenericEntityDao
- Returns:
-
getIdField
-
save
public <T> T save(T object) Description copied from interface:GenericEntityDao
Saves a generic entity- Specified by:
save
in interfaceGenericEntityDao
- Returns:
- the persisted version of the entity
-
persist
Description copied from interface:GenericEntityDao
Persist the new entity- Specified by:
persist
in interfaceGenericEntityDao
-
remove
Description copied from interface:GenericEntityDao
Remove the entity- Specified by:
remove
in interfaceGenericEntityDao
-
flush
public void flush()Description copied from interface:GenericEntityDao
Flush changes to the persistence store- Specified by:
flush
in interfaceGenericEntityDao
-
clearAutoFlushMode
public void clearAutoFlushMode()- Specified by:
clearAutoFlushMode
in interfaceGenericEntityDao
-
enableAutoFlushMode
public void enableAutoFlushMode()- Specified by:
enableAutoFlushMode
in interfaceGenericEntityDao
-
clear
public void clear()Description copied from interface:GenericEntityDao
Clear level 1 cache- Specified by:
clear
in interfaceGenericEntityDao
-
sessionContains
Description copied from interface:GenericEntityDao
Whether or not the current hibernate session (level 1) contains the object- Specified by:
sessionContains
in interfaceGenericEntityDao
- Returns:
-
idAssigned
Description copied from interface:GenericEntityDao
Whether or not this object is anEntity
and whether or not it already has an id assigned- Specified by:
idAssigned
in interfaceGenericEntityDao
- Returns:
-
getEntityManager
public jakarta.persistence.EntityManager getEntityManager()Description copied from interface:GenericEntityDao
Gathers theEntityManager
that is based on blPU- Specified by:
getEntityManager
in interfaceGenericEntityDao
- Returns:
- the
EntityManager
-
getEntityManager
-