OK the last (I think) remaining thing Im trying to get my head round on this subject is the precise granularity of DB updates.
From a combination of reading the docs and the source code I have managed to glean the following:
Session.getTransaction() and Transaction.commit() map to underlying DB begin/commit except where either a) FlushMode.NEVER is set, or b) the session maps onto some form of external transaction managment such as JTA.
However Im not entirely confident Ive worked this out correctly because the docs seem ambiguous:
From Session.flush():
Quote:
Force the Session to flush. Must be called at the end of a unit of work, before commiting the transaction and closing the session (Transaction.commit() calls this method).
This statement seems contraditory - "Must be called at the end of a unit of work" is surely false if "Transaction.commit() calls this method" (which indeed it does in the actual code).
I think I know whats its getting at but when I see the phrase "Must be called" in an API doc then I naturally assume that it means *I* must call it and I am assuming that I do not, and further more Im assuming that setting FlushMode.NEVER and manually calling flush() to batch up multiple hibernate transactions into one DB write is not a bonafide use of flush() in a JDBC environment.
Thanks,
Paul.