Was thinking some more today about the deprecation of Session.connection() The reason we deprecated it was that we need a way to scope access to the Connection because Session may have to release it due to "release mode". The back story here is that we added "connection release mode" as a way to fix an earlier problem using Hibernate in certain container-managed-transaction scenarios involving nested bean calls where they both used the same Session but the nested bean forced the session to obtain a Connection first. Hibernate tries to delay obtaining the JDBC Connection until needed. However, in the stated scenario that leads to a situation where the container managing the transaction sees a Connection "leaking" from the nested bean call since it was the one that forced the Connection to be obtained from the DataSource. The solution to this back then was to have Hibernate release the Connection whenever it was done using it for the moment in JTA cases. In retrospect, I think a much cleaner solution to the above situation is to force the Session to obtain the Connection up front rather than this obtain/release as-needed cycle.
So as one more attempt to save Session.connection() from going away, I wanted to propose that we drop the notion of "release mode" in favor of simply saying whether or not to aggressively acquire the Connection when the Session starts. Then all of the concerns that made deprecating and planning on removing Session.connection() are no longer there. WDYT? -- st...@hibernate.org http://hibernate.org _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev