Interface GenericEntityService

All Known Implementing Classes:
GenericEntityServiceImpl

public interface GenericEntityService
CRUD methods for generic entities
Author:
Andre Azzolini (apazzolini)
  • Method Details

    • readGenericEntity

      Object readGenericEntity(String className, Object id)
      Finds a generic entity by a classname and id
      Parameters:
      className -
      id -
      Returns:
      the entity
    • readGenericEntity

      <T> T readGenericEntity(Class<T> clazz, Object id)
    • save

      <T> T save(T object)
      Saves a generic entity
      Parameters:
      object -
      Returns:
      the persisted version of the entity
    • persist

      void persist(Object object)
      Persist the new object
      Parameters:
      object -
    • readCountGenericEntity

      <T> Long readCountGenericEntity(Class<T> clazz)
      Finds how many of the given entity class are persisted
      Parameters:
      clazz -
      Returns:
      the count of the generic entity
    • readAllGenericEntity

      <T> List<T> readAllGenericEntity(Class<T> clazz, int limit, int offset)
      Finds all generic entities for a given classname, with pagination options.
      Parameters:
      clazz -
      limit -
      offset -
      Returns:
      the entities
    • readAllGenericEntityId

      List<Long> readAllGenericEntityId(Class<?> clazz)
    • getIdentifier

      Serializable getIdentifier(Object entity)
      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

      boolean sessionContains(Object object)
      Whether or not the current hibernate session (level 1) contains the object
      Parameters:
      object -
      Returns:
    • idAssigned

      boolean idAssigned(Object object)
      Whether or not this object is an Entity and whether or not it already has an id assigned
      Parameters:
      object -
      Returns:
    • getCeilingImplClass

      Class<?> getCeilingImplClass(String className)
      Return the ceiling implementation class for an entity
      Parameters:
      className -
      Returns:
    • getEntityManager

      jakarta.persistence.EntityManager getEntityManager()
      Return the entity manager
      Returns:
    • remove

      void remove(Object object)
      Attempt to delete the entity
      Parameters:
      object -