【问题标题】:Hibernate db url configuratin issue with UTC mappingUTC映射的Hibernate db url configuratin问题
【发布时间】:2021-12-04 07:40:36
【问题描述】:

在 hibernate.cfg.xml 文件中配置数据库详细信息时收到以下错误消息。 检测到jdbc url错误,但无法找到实际原因。

原因:com.mysql.cj.exceptions.WrongArgumentException:无时区 映射条目 'UTC;allowPublicKeyRetrieval=true;useLegacyDatetimeCode=false' 在

hibernate.cfg.xml文件的sn-p

        <!-- JDBC Database connection settings -->
        <property name="connection.url">jdbc:mysql://localhost:3306/hb_student_tracker?useSSL=false&amp;serverTimezone=UTC;allowPublicKeyRetrieval=true</property>

【问题讨论】:

    标签: mysql xml spring hibernate orm


    【解决方案1】:

    使用下面的标签

    <property name="connection.url">jdbc:mysql://localhost:3306/hb_student_tracker?useSSL=false&amp;serverTimezone=UTC</property>
    

    用最新的 maven 版本替换 javax.persistance 对我有帮助。 maven入口如​​下

    <!-- https://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api -->
    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.1-api</artifactId>
        <version>1.0.2.Final</version>
    </dependency>
     
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-31
      • 2021-10-24
      • 1970-01-01
      • 1970-01-01
      • 2014-01-31
      • 2016-08-07
      • 2011-01-18
      • 1970-01-01
      相关资源
      最近更新 更多