开发者

Hibernate session.flush() in multi statement transaction

开发者 https://www.devze.com 2023-01-27 13:32 出处:网络
Hi I am facing strange behavior in hibernate. I am doinght.saveOrUpdate(myObj) on an object. In the same methodi am next loading a view from database which also contains the above

Hi I am facing strange behavior in hibernate.

I am doing ht.saveOrUpdate(myObj) on an object.

In the same method i am next loading a view from database which also contains the above

(table) myObj. 
ht.findByNamedParam( from myView ...)  ;   

But strangely in the loaded view do not have the recently updated values! I have also tried to ca开发者_StackOverflow社区ll ht.flush() before the load but still its fetching old values of tabel myObj and not the updated once. session.flush() is not working.

Code is something like : ( Note: all 3 are in same method and called in same transaction)

    ht.saveOrUpdate(myObj);  
    ht.flush();  
    ht.findByNamedParam( from myView....);  

Please suggest.

Thanks

0

精彩评论

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

关注公众号