zoukankan      html  css  js  c++  java
  • Mybatis 报错

    Mybatis 报错

    builder.BuilderException: Error parsing SQL Mapper Configuration

    Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/xxx/dao/UserDao.xml
    

    image-20200704162223175

    这个原因是我的 resources 文件下面的 package 不能建立,因此我将其标记为 test resources,问题解决

    image-20200704222258355

    It's likely that neither a Result Type nor a Result Map was specified

    这个原因是:Mybatis配置文件中没有返回类型参数

    Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException 是文件查询之后不知道将结果集封装到哪里

    image-20200704162325182

    因此在查询的方法id后面添加一个resultType,

    image-20200704212854636

    将结果封装至User

    image-20200704213215783

    InvalidConnectionAttributeException

    还有一个关于时区的问题,此问题为时区问题,在 JDBC 的连接 url 部分加上 serverTimezone=UTC 即可。
    如果选择utc会比中国时间早8个小时,如果在中国,可以选择Asia/Shanghai或者Asia/Hongkong

    UTC 即 Universal Time Coordinated 世界标准时间

    Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specifc time zone value if you want to utilize time zone support.
    

    解决方法:

    <property name="url" value="jdbc:mysql://localhost:3306/dbMybatis?serverTimezone=UTC"/>
    
  • 相关阅读:
    load custom class in drupal 8
    HEAD in Git
    composer version constraint 版本号前缀
    如何测试
    看待一段数据
    创建一个plugin
    eclipse的快捷方式
    .git文件夹的猜想
    本地可以但远程不行
    方法点不进去的原因
  • 原文地址:https://www.cnblogs.com/like3ong/p/13237010.html
Copyright © 2011-2022 走看看