JPA naming strategy preview
Work out what Hibernate will call your tables and columns before running the migration. Paste an entity class or just a list of names.
How the default strategy works
Spring Boot applies these steps to every table, column and sequence name:
- Replace each dot with an underscore
- Insert an underscore wherever a lowercase letter is followed by an uppercase letter that is itself followed by a lowercase letter
- Lowercase the whole thing
Step two is narrower than it looks. All three characters must line up, so a run of capitals is never split: myURL becomes myurl, notmy_url. The scan also stops one character early, so a trailing capital never splits either — valueA becomes valuea.
Explicit names are transformed too
This is the one that surprises people. @Column(name = "firstName") doesnot give you a firstName column — the physical naming strategy runs afterwards and turns it into first_name. To keep a name exactly as written, quote it:
@Column(name = "`firstName`") // backticks survive the strategy
@Column(name = "\"firstName\"") // so do escaped double quotesDigits changed in Hibernate 7
Older versions did not treat a digit as a word boundary, so address2Line becameaddress2line. Hibernate 7's PhysicalNamingStrategySnakeCaseImplcounts digits, giving address2_line. Toggle the checkbox above to compare — any name where the two disagree is flagged, because that is a column rename waiting to happen on upgrade.
Switching strategy
Set the physical strategy explicitly if you want Hibernate's untouched names:
spring.jpa.hibernate.naming.physical-strategy=\
org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImplThat keeps identifiers exactly as the entity spells them, which meansfirstName as a column and a case-sensitivity problem on any database that folds unquoted identifiers. Changing this on an existing schema renames every table and column, so it is a migration, not a setting.