Why hibernate session.close() does not flushes the data automatically?
问题 When hibernate closes a session, the purpose of close is basically to close the underlying connection and the clean up the first level cache. Why the flush also does not happens automatically here? 回答1: From a transactional point of view, flushing is very different from closing the session and flush should occur inside the boundaries of a transaction (or at commit time): Ending a Session usually involves four distinct phases: flush the session commit the transaction close the session handle