Interface GenericEntityService
- All Known Implementing Classes:
GenericEntityServiceImpl
public interface GenericEntityService
CRUD methods for generic entities
- Author:
- Andre Azzolini (apazzolini)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear level 1 cachevoid
void
void
flush()
Flush changes to the persistence storeClass<?>
getCeilingImplClass
(String className) Return the ceiling implementation class for an entityjakarta.persistence.EntityManager
Return the entity managergetIdentifier
(Object entity) Retrieve the identifier from the Hibernate entity (the entity must reside in the current session)boolean
idAssigned
(Object object) Whether or not this object is anEntity
and whether or not it already has an id assignedvoid
Persist the new object<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) readGenericEntity
(String className, Object id) Finds a generic entity by a classname and idvoid
Attempt to delete 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:
className
-id
-- Returns:
- the entity
-
readGenericEntity
-
save
<T> T save(T object) Saves a generic entity- Parameters:
object
-- Returns:
- the persisted version of the entity
-
persist
Persist the new object- 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
-
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:
-
getCeilingImplClass
Return the ceiling implementation class for an entity- Parameters:
className
-- Returns:
-
getEntityManager
jakarta.persistence.EntityManager getEntityManager()Return the entity manager- Returns:
-
remove
Attempt to delete the entity- Parameters:
object
-
-