Access to Session using Spring JPA and Hibernate in order to enable filters

前端 未结 2 1874
遥遥无期
遥遥无期 2020-12-03 18:32

In a Spring JPA + Hibernate environment I need to enable Hibernate entity filters. So I should have access to Hibernate Session object, but I\'m using EntityManagerFactory a

2条回答
  •  萌比男神i
    2020-12-03 19:37

    here's one i use for apps that support is_delete on objects -

        entityManager.unwrap(Session.class)
                .enableFilter("notDeleted")
                .setParameter("isDeleted", false);
    

提交回复
热议问题