A data definition language (DDL) is a language used to validate, export, configure and modify the schema of database objects in a database when the SessionFactory is created. It has got two main configurations:
spring.jpa.generate-ddl – This configuration takes a boolean value to either enable or disable schema initialization.
spring.jpa.hibernate.ddl-auto – This property takes an enum that controls the schema generation in a more controlled way.
The main difference between these two options is that the first one is vendor agnostic. As you know, Spring JPA uses hibernate as its vendor. But with enough configuration, you could use other vendors like eclipse-link, OpenJPA, DataNucleus, etc. In such cases, Spring Boot will choose an appropriate initialization mode based on the vendor.
The spring.jpa.hibernate.ddl-auto takes one of none, validate, update, create, and create-drop. By explicitly specifying one of these options, you are instructing Spring Boot on how to initialize the schema.
none - No action is performed. The schema will not be generated.
create-only - The database schema will be generated.
drop - The database schema will be dropped.
create - The database schema will be dropped and created afterward.
create-drop - The database schema will be dropped and created afterward. Upon closing the SessionFactory, the database schema will be dropped.
validate - The database schema will be validated using the entity mappings.
update - The database schema will be updated by comparing the existing database schema with the entity mappings.
WARNING: It is usual to see Hibernate users trying to use SchemaUpdate to update the schema of a production database automatically. This can quickly end in disaster and won't be allowed by your DBA.