spring.jpa.hibernate.hbm2ddl和spring.jpa.hibernate.ddl之间的区别 [英] Difference between spring.jpa.hibernate.hbm2ddl and spring.jpa.hibernate.ddl

查看:238
本文介绍了spring.jpa.hibernate.hbm2ddl和spring.jpa.hibernate.ddl之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

spring.jpa.hibernate.hbm2ddl spring.jpa.hibernate.ddl 有什么区别?

What is the difference between spring.jpa.hibernate.hbm2ddl and spring.jpa.hibernate.ddl?

我在以下问题中发现:什么是OP在属性中同时使用了spring.datasource.initialization-mode?的可能值,但是hbm2ddl的来源似乎直接休眠而不是Spring Data Jpa.

I have found in this question: What are the possible values of spring.datasource.initialization-mode? that OP is using both in properties, however it seems like the origin of hbm2ddl is hibernate directly not Spring Data Jpa.

尽管如此,从另一个OP中读取答案,它看起来像只是传递.

Nevertheless, reading the answer from another OP, it looks like pass-through only.

但是,在我们使用mariadb的商业项目中,当我们没有通过 spring.jpa.hibernate.hbm2ddl.auto=create 正常关闭Spring Boot应用程序时,再次运行该应用程序时,它将删除旧数据并从头开始创建所有内容.另一方面,使用 spring.jpa.hibernate.ddl.auto=create 每秒运行一次(在没有正常关闭应用程序之后)会导致关键约束异常(数据库在创建之前没有被删除)

However in our commercial project with mariadb, when we do not close our spring boot application gracefully with spring.jpa.hibernate.hbm2ddl.auto=create, when the application is run again, it deletes old data and creates everything from scratch. On the other hand with spring.jpa.hibernate.ddl.auto=create every second run (after no graceful application shutdown) causes key constraint exceptions (DB is not being dropper before creation)

推荐答案

  1. 从此
查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆