Quote:
I'm still interested in the origin of the "reading data doesn't require transactions" myth. Who told you? :)
I wouldn't say anyone told me.
Hibernate additions aside, transactions can be used to join statements together into one unit and can be used to preserve a 'view' of data via levels of isolation.
The application concerned, collects fluid levels from sensors so the data is very simple. Multiple statements are joined together with a transaction because an averages table is updated for every new record. When reading takes place, as the data is effectively read-only (no records are ever updated) transaction isolation is not needed.
I appreciate that JDBC uses the automatic transaction per statement but from the API perspective there is nothing less than one statement of work. In effect, this operates directly on the db.
The original application talked directly to the db using ESLQ/C. I don't know what isolation levels were supported (Informix SE 5.0) but, from an application perspective, there was no chance for a dirty read.
The application was ported once to Java using JDBC and now to Hibernate. So, the answer to your question is, it's probably historic.
However, the reason for the original post was to determine if there was any extra trickery going on behind the scenes as part of the Hibernate additions to the transaction code which users should be aware of. For example, Hibernate managed transactions automatically perform a flush.