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 DynamicDaoHelperImplprotected jakarta.persistence.EntityManagerprotected EntityConfigurationprotected PersistenceServiceprotected StreamingTransactionCapableUtil -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear level 1 cachevoidvoidvoidflush()Flush changes to the persistence storeClass<?>getCeilingImplClass(String className) Finds the ceiling implementation for the entityjakarta.persistence.EntityManagerGathers theEntityManagerthat is based on blPUprotected jakarta.persistence.EntityManagergetEntityManager(Class clazz) static GenericEntityDaoImplgetIdentifier(Object entity) Retrieve the identifier from the Hibernate entity (the entity must reside in the current session)protected FieldgetIdField(Class<?> clazz) Class<?>getImplClass(String className) For a given className, finds the parent implementation class as defined in theEntityConfigurationbooleanidAssigned(Object object) Whether or not this object is anEntityand whether or not it already has an id assignedvoidPersist 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> LongreadCountGenericEntity(Class<T> clazz) Finds how many of the given entity class are persisted<T> TreadGenericEntity(Class<T> clazz, Object id) Finds a generic entity by a classname and idvoidRemove the entity<T> Tsave(T object) Saves a generic entitybooleansessionContains(Object object) Whether or not the current hibernate session (level 1) contains the objectvoidsetApplicationContext(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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
readGenericEntity
Description copied from interface:GenericEntityDaoFinds a generic entity by a classname and id- Specified by:
readGenericEntityin interfaceGenericEntityDao- Returns:
- the entity
-
readCountGenericEntity
Description copied from interface:GenericEntityDaoFinds how many of the given entity class are persisted- Specified by:
readCountGenericEntityin interfaceGenericEntityDao- Returns:
- the count of the generic entity
-
readAllGenericEntity
Description copied from interface:GenericEntityDaoFinds all generic entities for a given classname, with pagination options.- Specified by:
readAllGenericEntityin interfaceGenericEntityDao- Returns:
- the entities
-
readAllGenericEntity
- Specified by:
readAllGenericEntityin interfaceGenericEntityDao
-
readAllGenericEntityId
- Specified by:
readAllGenericEntityIdin interfaceGenericEntityDao
-
getImplClass
Description copied from interface:GenericEntityDaoFor a given className, finds the parent implementation class as defined in theEntityConfiguration- Specified by:
getImplClassin interfaceGenericEntityDao- Returns:
- the impl class object
-
getCeilingImplClass
Description copied from interface:GenericEntityDaoFinds the ceiling implementation for the entity- Specified by:
getCeilingImplClassin interfaceGenericEntityDao- Returns:
-
getIdentifier
Description copied from interface:GenericEntityDaoRetrieve the identifier from the Hibernate entity (the entity must reside in the current session)- Specified by:
getIdentifierin interfaceGenericEntityDao- Returns:
-
getIdField
-
save
public <T> T save(T object) Description copied from interface:GenericEntityDaoSaves a generic entity- Specified by:
savein interfaceGenericEntityDao- Returns:
- the persisted version of the entity
-
persist
Description copied from interface:GenericEntityDaoPersist the new entity- Specified by:
persistin interfaceGenericEntityDao
-
remove
Description copied from interface:GenericEntityDaoRemove the entity- Specified by:
removein interfaceGenericEntityDao
-
flush
public void flush()Description copied from interface:GenericEntityDaoFlush changes to the persistence store- Specified by:
flushin interfaceGenericEntityDao
-
clearAutoFlushMode
public void clearAutoFlushMode()- Specified by:
clearAutoFlushModein interfaceGenericEntityDao
-
enableAutoFlushMode
public void enableAutoFlushMode()- Specified by:
enableAutoFlushModein interfaceGenericEntityDao
-
clear
public void clear()Description copied from interface:GenericEntityDaoClear level 1 cache- Specified by:
clearin interfaceGenericEntityDao
-
sessionContains
Description copied from interface:GenericEntityDaoWhether or not the current hibernate session (level 1) contains the object- Specified by:
sessionContainsin interfaceGenericEntityDao- Returns:
-
idAssigned
Description copied from interface:GenericEntityDaoWhether or not this object is anEntityand whether or not it already has an id assigned- Specified by:
idAssignedin interfaceGenericEntityDao- Returns:
-
getEntityManager
public jakarta.persistence.EntityManager getEntityManager()Description copied from interface:GenericEntityDaoGathers theEntityManagerthat is based on blPU- Specified by:
getEntityManagerin interfaceGenericEntityDao- Returns:
- the
EntityManager
-
getEntityManager
-