[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-901) TransactionHelper doesn't restore autocommit setting
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Mar 21 13:00:32 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-901?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Ebersole closed HHH-901.
------------------------------
Closing stale resolved issues
> TransactionHelper doesn't restore autocommit setting
> ----------------------------------------------------
>
> Key: HHH-901
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-901
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0.5
> Environment: Hibernate 3.0.5, sybase ase 12.5
> Reporter: Paul Lorenz
> Priority: Minor
>
> When the TransactionHelper gets a connection, it sets auto commit to false. Later, when the connection is commited, the auto commit flag isn't restored. Is this supposed to be handled by the connection pool?
> Here is a patch to change this behaviour
> -----------------------------------------------------
> --- foo.java 2005-08-23 17:26:02.000000000 -0400
> +++ TransactionHelper.java 2005-08-23 17:30:06.000000000 -0400
> @@ -43,6 +43,7 @@
> String sql = null; // for exception
> boolean isJta = tm != null;
> boolean catchedException = false;
> + boolean isAutoCommitEnabled = false;
> try {
> if ( isJta ) {
> //JTA environment
> @@ -58,7 +59,8 @@
> else {
> // get connection from the hibernate defined pool
> conn = session.getBatcher().openConnection();
> - if ( conn.getAutoCommit() ) conn.setAutoCommit( false );
> + isAutoCommitEnabled = conn.getAutoCommit();
> + if ( isAutoCommitEnabled ) conn.setAutoCommit( false );
> }
> Serializable result = doWorkInCurrentTransaction( conn, sql );
> @@ -69,6 +71,7 @@
> }
> else {
> conn.commit();
> + if ( isAutoCommitEnabled ) conn.setAutoCommit( true );
> }
> return result;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list