Spring boot + Hibernate + JPA No transactional EntityManager available

前端 未结 3 1938
再見小時候
再見小時候 2021-02-07 08:43

I am using spring boot 1.2.3.RELEASE version with JPA over hibernate. I am experiencing following exception

org.springframework.dao.InvalidDataAccessApiUsageExce         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-07 09:10

    I still got the No transactional EntityManager available exception even after annotating my search() method with @Transactional.

    I followed this tutorial which describes how to set up Hibernate search in Spring Boot.

    The issue for me was that I had a different dependency on hibernate-search-orm. The dependency which worked for me without any problems was

    compile("org.hibernate:hibernate-search-orm:5.7.0.Final")
    

    After adding this to the gradle build file, everything worked as expected.

    Hope this helps someone else as well.

提交回复
热议问题