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.
精彩评论