Hibernate db url configuratin issue with UTC mapping

Viewed 26

Getting below error message while configuring db details in hibernate.cfg.xml file. Sensing a mistake in jdbc url, But not able to find the actual cause.

Caused by: com.mysql.cj.exceptions.WrongArgumentException: No timezone mapping entry for 'UTC;allowPublicKeyRetrieval=true;useLegacyDatetimeCode=false' at

snippet of hibernate.cfg.xml file

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

Using below tag

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

and replacing javax.persistance with latest maven version helped me. maven entry as below

<!-- 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>
 
Related