Im working on a webapplication with Spring Framework 3 and Hibernate 3.6 and I try to understand how transaction management works. I use mySQL Server 5.1 with InnoDB tables. I wrote my DAO based on plain Hibernate 3 API.
1) Is it correct, that mySQL Server itself specifies how transactions are handled? That means it decides when records need to be locked or not?
2) When I declare a method in spring as @transactional(readOnly=true) or @transactional(readOnly=false) does this affect if the datarecords are locked during the transaction? This means, when readOnly=true, no datarecord is locked and when readOnly=false all used datarecords are locked?
3) What happens when I got readOnly=true and I read various data records. Lets assume in the middle of reading they are changed by another transaction, so that I get some old records and some new records. Is that possible?
4) When does a commit happen? After a successful transaction or when a session is closed?
5) when does a hibernate-session start? for each session (between server and client) or for each transaction?
6) in the end, who has the responsibility for transaction management? spring or mysql or both?
Thanks for answering! :-)