MyBatis cannot insert data... my error

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.