Hibernate and JDBC in one transaction

后端 未结 3 1971
攒了一身酷
攒了一身酷 2021-01-04 23:57

I have a method, marked as @Transactional. It consists of several functions, one of them uses JDBC and the second one - Hibernate, third - JDBC. The problem is that changes,

3条回答
  •  一整个雨季
    2021-01-05 00:35

    First, avoid using JDBC when using hibernate.

    Then, if you really need it, use to Session.doWork(..). If your hibernate version does not yet have this method, obtain the Connection from session.connection().

提交回复
热议问题