Interface GenericEntityService
- All Known Implementing Classes:
GenericEntityServiceImpl
public interface GenericEntityService
CRUD methods for generic entities
- Author:
- Andre Azzolini (apazzolini)
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear level 1 cachevoidvoidvoidflush()Flush changes to the persistence storeClass<?>getCeilingImplClass(String className) Return the ceiling implementation class for an entityjakarta.persistence.EntityManagerReturn the entity managergetIdentifier(Object entity) Retrieve the identifier from the Hibernate entity (the entity must reside in the current session)booleanidAssigned(Object object) Whether or not this object is anEntityand whether or not it already has an id assignedvoidPersist 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> LongreadCountGenericEntity(Class<T> clazz) Finds how many of the given entity class are persisted<T> TreadGenericEntity(Class<T> clazz, Object id) readGenericEntity(String className, Object id) Finds a generic entity by a classname and idvoidAttempt to delete 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:
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 anEntityand 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-
-