Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB-Connection is set to autocommit mode which breaks manual commit #15

Open
pichlerm opened this issue May 16, 2018 · 0 comments
Open

Comments

@pichlerm
Copy link

We use Liquibase together with Hibernate transaction handling in an application. Hibernate expects DB connections to be not in autocommit mode.

liquibase.database.ext.HanaDBDatabase#supportsDDLInTransaction returns false
which causes getAutoCommitMode() of the base class to return true, used in setConnection(DatabaseConnection) where connection.setAutoCommit is set on the DatabaseConnection - true in case of the HanaDB.
When the same DB-connection is used by Hibernate and explicitly committed at
the end of a transaction, the Hana JDBC driver throws an exception:
com.sap.db.jdbc.exceptions.JDBCDriverException: SAP DBTech JDBC: Connection is currently in auto commit mode.

Our workaround was to override HanaDBDatabase#getAutoCommitMode() to return false.

Possilby supportsDDLInTransaction might return true (like for Oracle and MS-SQL).
You refer to http://help.sap.com/saphelp_hanaplatform/helpdata/en/20/fdf9cb75191014b85aaa9dec841291/content.htm

However there is also a SET TRANSACTION AUTOCOMMIT DDL statement which claims that rollbacks of DDL statements are supported.
https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.00/en-US/d538d11053bd4f3f847ec5ce817a3d4c.html

Not sure, which one is true, and where the SET TRANSACTION AUTOCOMMIT DDL ON had to be placed.
Also not sure, which side effects the return false by HanaDBDatabase#getAutoCommitMode() might cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant