Package org.broadleafcommerce.common.dao
Interface GenericEntityDao
- All Known Implementing Classes:
GenericEntityDaoImpl
public interface GenericEntityDao
Provides methods to easily access entities managed by the 'blPU'
PersistenceUnit.-
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 blPUgetIdentifier(Object entity) Retrieve the identifier from the Hibernate entity (the entity must reside in the current session)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 object
-
Method Details
-
readGenericEntity
Finds a generic entity by a classname and id- Parameters:
clazz-id-- Returns:
- the entity
-
getImplClass
For a given className, finds the parent implementation class as defined in theEntityConfiguration- Parameters:
className-- Returns:
- the impl class object
-
getCeilingImplClass
Finds the ceiling implementation for the entity- Parameters:
className-- Returns:
-
save
<T> T save(T object) Saves a generic entity- Parameters:
object-- Returns:
- the persisted version of the entity
-
persist
Persist the new entity- Parameters:
object-
-
remove
Remove the entity- Parameters:
object-
-
readCountGenericEntity
Finds how many of the given entity class are persisted- Parameters:
clazz-- Returns:
- the count of the generic entity
-
readAllGenericEntity
Finds all generic entities for a given classname, with pagination options.- Parameters:
clazz-limit-offset-- Returns:
- the entities
-
readAllGenericEntity
-
readAllGenericEntityId
-
getIdentifier
Retrieve the identifier from the Hibernate entity (the entity must reside in the current session)- Parameters:
entity-- Returns:
-
flush
void flush()Flush changes to the persistence store -
clearAutoFlushMode
void clearAutoFlushMode() -
enableAutoFlushMode
void enableAutoFlushMode() -
clear
void clear()Clear level 1 cache -
sessionContains
Whether or not the current hibernate session (level 1) contains the object- Parameters:
object-- Returns:
-
idAssigned
Whether or not this object is anEntityand whether or not it already has an id assigned- Parameters:
object-- Returns:
-
getEntityManager
jakarta.persistence.EntityManager getEntityManager()Gathers theEntityManagerthat is based on blPU- Returns:
- the
EntityManager
-