Home > Back-end >  MyBatis Spring integration, transaction configuration will not be managed by the Spring
MyBatis Spring integration, transaction configuration will not be managed by the Spring

Time:09-21

 Creating a new SqlSession 
SqlSession [org. Apache. Ibatis. Session. Defaults. DefaultSqlSession @ 76 ebf212] was not registered for synchronization because synchronization is not active
Creating a new SqlSession
SqlSession [org. Apache. Ibatis. Session. Defaults. DefaultSqlSession @ 7 c61b8bc] was not registered for synchronization because synchronization is not active
Creating a new SqlSession
SqlSession [org. Apache. Ibatis. Session. Defaults. DefaultSqlSession @ 6 aa9548e] was not registered for synchronization because synchronization is not active
The JDBC Connection [JDBC: mysql://localhost: 3307/ge_test, UserName=root @ localhost, mysql Connector Java] will not be managed by the Spring
The JDBC Connection [JDBC: mysql://localhost: 3307/ge_test, UserName=root @ localhost, mysql Connector Java] will not be managed by the Spring
The JDBC Connection [JDBC: mysql://localhost: 3307/ge_test, UserName=root @ localhost, mysql Connector Java] will not be managed by the Spring

The console prompt, I will be Creating a new each time you execute SQL SqlSession, such serious image performance? I clearly configuration transaction, and tested the transaction is valid, why also suggests I don't have to spring transaction management?

Transaction configuration code:
 









Personally tested, if executed two dao methods in the Service, the first after the execution, I manually throwing an exception, will be rolled back,

To you, why is this case?
Question, why every time Creating a new SqlSession, will not affect performance?
Question 2, clearly configuration transaction, it prompts the transaction not to spring management, solving,

Thank you all for a great god, and there are satisfied with the answer is "stickers to,

CodePudding user response:

The great god to help me solve the problem, their top up

CodePudding user response:

Don't let post sink, thank you for your kind

CodePudding user response:

Question, why every time Creating a new SqlSession, will not affect performance?

That is the information, is on a database connection, starting the transaction, create an object to manage the affairs, is issued on the database connection, start, object to record the related information, very little effect on the performance

Question 2, clearly configuration transaction, it prompts the transaction not to spring management, to solve the

Is not spring connection management (should be built on the application server), the transaction or spring management, also is normal

CodePudding user response:

The
reference 3 floor q54244125 response:


What? All is normal? Database connection is to manage the spring, I put the database connection pool code post
 
Destroy - method="close" & gt;






CodePudding user response:

The previous answer wrong

You this is the integration of the spring is no good, org. Springframework). The JDBC datasource. DataSourceTransactionManager should use org. Springframework). The JDBC datasource. DataSourceTransactionManager

Reference: http://www.mybatis.org/spring/zh/transactions.html

CodePudding user response:

Not in state, mistakes continuously

CodePudding user response:

Chances are you're mybatis - spring jar didn't introduce version or not

CodePudding user response:

Change the execution (* com. KWJQ. Web. Service. *. Impl. *. * (.. ))

CodePudding user response:

Reference:

In the history of the most Simple spring + for springMVC + ~ Simple - SSM mybaits integrate SSM framework

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related