开发者

Could not force hibernate to go to the database to get new object

开发者 https://www.devze.com 2023-04-09 06:48 出处:网络
Session Factory: hibernate.current_session_context_class=jta hibernate.cache.use_second_level_cache=false

Session Factory:

hibernate.current_session_context_class=jta
hibernate.cache.use_second_level_cache=false

Transaction: - UserTransaction is used.

getCurrentSession() of SessionFactory is used to get Session.

The problem is that I could not force the hibernate to access database to get the new values using Session.get(...)开发者_如何转开发 (it is updated outside) although I used Session.clear() or Session.evict(…) or Session.refresh(…), SessionFactory.evict(...).

It always kept the old values.

Do you have any idea?


session.flush() --- will flush your memory update in db. session.clear() will clear session.

Now query again will fire on database.

0

精彩评论

暂无评论...
验证码 换一张
取 消