码迷,mamicode.com
首页 > 编程语言 > 详细

SpringMVC Mybatis Spring

时间:2017-09-29 11:06:47      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:注解   reflect   mon   autowired   cto   database   depend   imp   lang   

Spring MVC Mybatis整合过程中
Mapper.java 不需要使用 @componenet, Service 等spring注解
但是在service 中创建mapper对象的时候是需要使用·Resource @Autowired 注解的

### Error updating database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class ‘com.microsoft.sqlserver.jdbc.SQLServerDriver‘
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class ‘com.microsoft.sqlserver.jdbc.SQLServerDriver‘
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
... 43 more

have already add mssql jdbc driver and also manual check the class exists.
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
<scope>test</scope>
</dependency>

 

通过mybatis insert foreach 批量插入mysql 因为sqlserver的限制 每次最多只能插入1000条数据  

SpringMVC Mybatis Spring

标签:注解   reflect   mon   autowired   cto   database   depend   imp   lang   

原文地址:http://www.cnblogs.com/zi-yao/p/7609889.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!