zoukankan      html  css  js  c++  java
  • SpringMVC Mybatis Spring

    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条数据  

  • 相关阅读:
    AwaitAsync(异步和多线程)
    Newtonsoft.Json高级用法
    C# DataTable 去重复数据方法
    C# List 根据对象属性去重的四种方法对比
    C# <T>泛型的使用
    LeetCode 368. Largest Divisible Subset
    LeetCode 357. Count Numbers with Unique Digits
    LeetCode 350. Intersection of Two Arrays II
    LeetCode 349. Intersection of Two Arrays
    LeetCode 344. Reverse String
  • 原文地址:https://www.cnblogs.com/zi-yao/p/7609889.html
Copyright © 2011-2022 走看看