spring-boot - 如何告诉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.jpa.hibernate.ddl-auto=update
推荐阅读
- bash - bash 中没有 sudo 的命令不起作用
- java - 如何在循环中更新标签
- ubuntu - 使用来自 Cloudflare 的 .pem 和 .key 设置 Ubuntu Apache2 SSL
- python - 使用字典和贪心算法解决 Set Cover 问题时的返回键
- java - 为什么 equals() 方法不能按预期工作?
- javascript - 如何在 2020 年使用纯 javascript 从 id 获取 YouTube 嵌入视频标题?
- php - 登录后回显受保护的内容
- ansible - 列表的 Ansible/YAML 格式不一致?
- sql-server - Vim dadbod 配置适配器
- javascript - 将日期从 UTC 转换为 EST(Javascript、HTML)