我正在尝试使用hibernate逆向工程从mysql数据库自动生成实体模型。我正在使用mysql server 8并开发一个spring boot应用程序2.2.4。在我的应用程序中,我已经在build.gradle中包含了spring-jpa和mysql连接驱动程序。
build.gradle
buildscript {
ext {
springBootVersion = '2.2.4.RELEASE'
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.kafka:spring-kafka'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'mysql:mysql-connector-java:8.0.19'
}hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/test?useTimezone=true&serverTimezone=UTC</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.default_schema">test</property>
</session-factory>
</hibernate-configuration>我将我的java库和java编译器降级到1.8,但最初我使用的是java11。我降级到java 1.8的原因是hibernate配置没有检测到我的项目的类路径。
我的mysql java连接器: mysql-connector-java-8.0.19
ERROR message from hibernate configuration when viewing the database
发布于 2020-04-02 08:36:37
我将我的mysql版本降级到5.x,现在它可以工作了。我不知道为什么它不能与我的版本8一起工作
https://stackoverflow.com/questions/60593407
复制相似问题