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 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 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 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 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 anEntity
and whether or not it already has an id assigned- Parameters:
object
-- Returns:
-
getEntityManager
jakarta.persistence.EntityManager getEntityManager()Gathers theEntityManager
that is based on blPU- Returns:
- the
EntityManager
-