🐛 Bug Description
When using Spring Data JPA with @column(columnDefinition = "TEXT"), Hibernate executes an unnecessary ALTER TABLE statement every time the application starts.
In PostgreSQL, if a column is already of type TEXT, Hibernate should not alter its type repeatedly. However, it keeps executing:
ALTER TABLE example.tbl_product ALTER COLUMN description SET DATA TYPE TEXT;
This behavior is problematic because it introduces unnecessary schema modifications, increases startup time, and might impact performance.
🎯 Expected Behavior
- If the column is already of type TEXT, Hibernate should not execute ALTER TABLE again.
- Schema validation should detect that the column type is unchanged and avoid unnecessary DDL statements.
1️⃣ Entity Code
@Column(columnDefinition = "TEXT")
var description: String
2️⃣ application.yml Configuration
spring:
jpa:
hibernate:
ddl-auto: update
🛠 Environment Details
Spring Boot : 3.3.4
Spring Data JPA : 3.3.4
Hibernate : 6.5.3.Final