Force Hibernate to read database and not return cached entity

后端 未结 4 1313
孤独总比滥情好
孤独总比滥情好 2021-01-01 11:10

I am using Hibernate and Spring for my web application.

In database operation, Hibernate is caching entities and returning them in next request without reading the a

4条回答
  •  心在旅途
    2021-01-01 12:08

    session.refresh(entity) or entityManager.refresh(entity) (if you use JPA) will give you fresh data from DB.

提交回复
热议问题