When I learned this, I found that myBatis could not execute insert from mysql to SqlServer, which may be a transaction problem. I checked the code carefully and found that configurationtypeAliasestypeAliastypecn. java. domain. Conflict
When I learned from myself, I found that myBatis could not execute insert to switch from mysql to SQL Server. So I thought it could be a transaction problem... check the code carefully and find that: configuration typeAliases typeAlias type = cn. java. domain. account alias = Account // typeAliases environments default = developmentenvironme
When I learned from myself, I found that myBatis could not execute insert to switch from mysql to SQL Server. So I thought it could be a transaction problem...
Check the code carefully and find that:
<Configuration> <typeAliases> <typeAlias type = "cn. java. domain. account "alias =" Account "/> </typeAliases> <environments default =" development "> <environment id =" development "> <! -- <TransactionManager type = "MANAGED"> <property name = "closeConnection" value = "false"/> </transactionManager> --> <transactionManager type = "JDBC"> </transactionManager> <dataSource type = "POOLED"> <property name = "driver" value = "com. mysql. jdbc. driver "/> <property name =" url "value =" jdbc: mysql: // localhost: 3306/test "/> <property name =" username "value =" root "/> <property name =" password "value =" 123456 "/> </dataSource> </ environment> </environments> <mappers> <mapper resource = "cn/java/domain/Account. xml "/> </mappers> </configuration>
By the way, this is what we did.
....
Type = [jdbc or managed]
JDBC should use the jdbc transaction processing.
The MANAGED configuration is neither submitted nor rolled back (The problem is here !), It will allow containers such as spring to manage transactions. If yes ..
Mark, continue learning.