开发者

How to force hibernate not to save and data updates on session closing?

For example I have entity extracted开发者_运维知识库 from hibernate session User user = session.getById(12); user.setName('new_name') reject request After this code block I do not want to store updates to user and use it purely as Data Bean but also I do not want to detach it from session because I want lazy loading. For modification i want to use methods save, saveOrUpdate. Is it possible to said hibernate not to automatically update all modified fields of session objects?


FLUSHMODE.MANUAL only flushes if you specifically say to, I believe.


You can use stateless sessions. They don't do any dirty checking and corresponding auto-magic updates. Obviously, you would lose session cache (you can keep track of your objects yourself) and batched inserts/deletes/updates.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜