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

JdbcTransaction changes autoCommit to true for shared Connections #2892

Open
hkuhn42 opened this issue Jun 26, 2023 · 0 comments
Open

JdbcTransaction changes autoCommit to true for shared Connections #2892

hkuhn42 opened this issue Jun 26, 2023 · 0 comments

Comments

@hkuhn42
Copy link

hkuhn42 commented Jun 26, 2023

The constructor for JdbcTranscation with connection should either never trigger a auto commit reset or should check skipSetAutoCommitOnClose flag.

MyBatis version

3.5.13

Database vendor and version

Oracle 19.3 SE2 (probably all other databases)

Test case or example project

Connection conn = null;             // get connection from pool
conn.setAutoCommit(false);
// do something via jdbc
SqlSessionFactory sqlSessionFactory = null;             // create factory with skipSetAutoCommitOnClose
SqlSession sqlSession = sqlSessionFactory.openSession(conn);
// to nothing
sqlSession.close(); // auto commit is set in close, everything  is committed

Steps to reproduce

  • Open a connection via jdbc
  • Set auto commit to false
  • Open a SqlSession
  • Close SqlSession

Expected result

  • Auto commit is still false, no auto commit is done on close

Actual result

  • Auto commit is true, commit is done on close
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