Package top.codef.dao

Class AbstractDao

java.lang.Object
top.codef.dao.AbstractDao
All Implemented Interfaces:
AmebaDao
Direct Known Subclasses:
BaseDao, TypedBaseDao

public abstract class AbstractDao extends Object implements AmebaDao
  • Constructor Details

    • AbstractDao

      public AbstractDao()
  • Method Details

    • getEntityManager

      public jakarta.persistence.EntityManager getEntityManager()
      获取当前数据连接对应的entitymanager
      Specified by:
      getEntityManager in interface AmebaDao
    • getSession

      public org.hibernate.Session getSession()
      获取hibernate session
      Returns:
    • create

      public <T> void create(T entity)
      持久化实体
      Type Parameters:
      T - Entity实体类型
      Parameters:
      entity - 要创建的实体
    • detach

      public <T> void detach(T entity)
      游离化实体
      Type Parameters:
      T -
      Parameters:
      entity -
    • createOrUpdate

      public <T> void createOrUpdate(T entity)
      Type Parameters:
      T -
      Parameters:
      entity -
    • merge

      public <T> void merge(T entity)
      合并实体
      Type Parameters:
      T -
      Parameters:
      entity -
    • delete

      public <T> void delete(Class<T> clazz, Serializable id)
      通过id删除实体
      Type Parameters:
      T -
      Parameters:
      clazz -
      id - 实体id
    • delete

      public <T> void delete(T value)
      删除实体
      Type Parameters:
      T -
      Parameters:
      value -
    • get

      public <T> T get(Class<? extends T> clazz, Serializable id)
      根据id获取实体
      Type Parameters:
      T -
      Parameters:
      clazz -
      id - 实体id
      Returns:
    • flush

      public void flush()
      同步持久化上下文
    • refresh

      public <T> void refresh(T entity)
      同步持久化对象
      Type Parameters:
      T -
      Parameters:
      entity -
    • lock

      public <T> void lock(T entity, jakarta.persistence.LockModeType lockModeType)
      给实体对象加锁
      Type Parameters:
      T -
      Parameters:
      entity -
      lockModeType -