The hibernation documentation states the following:
The hibernate.connection.release_mode configuration parameter is used to specify the release mode. Possible values: * auto (default) - the equivalent of after_transaction in the current version. It is rarely a good idea to change this default behavior, because errors due to the value of this parameter tend to indicate errors and / or invalid assumptions in the user code. * on_close - Says to use ConnectionReleaseMode.OnClose. This option is left for backward compatibility, but its use is very discouraged ....
I created an integration test that throws a StaleObjectException, while simultaneously opening two sessions and manipulating the same object. To ensure that the test rollers return everything upon completion, the test content is placed in a TransactionScope; this leads to transaction breaks, as two sessions open the db connection against the same external transaction. I want to change the ConnectionReleaseMode default parameter to "OnClose", but as stated above, the documentation does not recommend this. Can someone explain why it is not recommended to change the default behavior?
nhibernate
Marius
source share