首页 > 解决方案 > 如何告诉Springboot使用mysql中的现有表而不是创建一个新表

问题描述

我正在尝试使用 Springboot 做一个使用 Mysql 和 Angular 的应用程序。如果我运行 spring 应用程序,它会在 mysql 中创建一个新表,并将值插入其中。即使我将大写的表名写为“ T_EMPLEAVE”,springboot 正在创建一个小写的新表为“ t_empleave ”。此外,我在 Mysql 中创建了大写的表。但是,我的应用程序没有使用它。如何告诉 Spring boot 使用现有表而不是创建新表。

以下是我的 application.properties 文件。

spring.datasource.username=**
spring.datasource.password=***
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

模型

@Entity
@Table(name="T_EMPLEAVE")

标签: spring-boot

解决方案


尝试将以下内容添加到您的属性文件或更新该行(如果它已存在):

spring.jpa.hibernate.ddl-auto=update

推荐阅读