mbrunecky wrote:
You keep saying that to fix the problem, I should configure Hibernate to use autocommit.
Granted, that releases JDBC Conection - because it essentially changes ConnectionReleaseMode to AFTER_STATEMENT
This is the mode you want, right? So why don't you do what I keep telling you and argue with me instead?
Quote:
However, using auto-commit mode is UNACCEPTABLE.
Make up your mind! Either you want it or not. You can't have anything else because there is nothing else.
Quote:
Using auto-commit=true can make sense in some specific scenario, but as you so eloquently describe in your book,
"Auto commit mode is almost always inappropriate in application"
(in my case application twice as big as Hibernate, using Hibernate both as a thick client and on JBoss side)
Reflect on the words "almost always".
Quote:
Hibernate InAction, 5.1.1, JDBC and JTA transactions clearly states:
"If a database connection is in auto commit mode, the database transaction will be commited immediatelly after each SQL statement,
and a new transaction will be started".
AT THE JDBC/SQL LEVEL.
This is the auto-commit behavior AT THE HIBERNATE LEVEL if you ENABLE it: The Session gets a connection, the connection is (put) in auto-commit mode, the Session executes a SQL statement (maybe to initialize a proxy or collection), the statement is committed immediately, the Session returns the connection to the pool.
THERE IS NO OTHER MODE if you don't want to wrap an EXPLICIT transaction block around your lazy loading (which is what most applications do, see "almost always").
Your magic "Hibernate should wrap a Hibernate transaction around this" is exactly what the auto-commit mode already does. YOU NEED TO ENABLE IT.
Quote:
(I am sorry i did not buy your latest book yet - I did not plan on spending so much effort on Hibernate troubleshooting).
You sure seem to expect that others put in a lot of effort to explain things to you. Nice. EOD from my side.