开发者

In AUTO flush mode will a commit automatically flush pending SQLs

In Hibernate will a commit automatically flush() the session before committing?

Will the following code work (will the the property change on animal be persisted) in FlushMode.AUTO?

Session session = <get session>;
session.beginTra开发者_StackOverflow社区nsaction();
Animal animal = session.load(Animal.class, 1L);
animal.hasEatenForToday(true);
session.getTransaction().commit();

Or do I have to include a session.flush() before the commit?


Yes hibernate will flush all changes of persistent objects attached to current session before commiting it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜