0

With Spring Boot 2, the "update" DDL setting would create new tables, but it would not change column types and sizes, add columns, or do other fine-grained changes to the schema. With Spring Boot 3 and Hibernate 6.1, the update is much more aggressive, including:

  • String column lengths and types are changed to the default, e.g. VARCHAR2(255 CHAR) for strings
  • Foreign key relationships are being set up even though they already exist (causing errors)

This is a problem, because we have many tables and many string columns with much smaller values. Using DDL "update" on this schema now changes hundreds of column types (example: from VARCHAR2(8 BYTE) to VARCHAR2(255 CHAR)) which is not desirable.

I have the option of adding "length=x" to each @Column annotation to prevent the length changes, but this is a lot of work I'd like to avoid.

Is it possible to get the older behavior in Spring Boot 3?

Is there any documentation discussing this new behavior? This doesn't seem to mention it: https://docs.jboss.org/hibernate/orm/6.0/migration-guide/migration-guide.html

These are the properties used:

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.OracleDialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
Joshua Swink
  • 3,380
  • 3
  • 29
  • 27

0 Answers0