Skip to content

Commit

Permalink
[#89] fix: hibernate 6에 맞춰서 PhysicalNamingStrategyStandardImpl 네이밍 전략…
Browse files Browse the repository at this point in the history
…이 되도록 수정
  • Loading branch information
yeseul106 committed Dec 4, 2023
1 parent 2ca99cf commit 7a2a611
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.sopt.makers.crew.main.common.config;

import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;

public class CamelCaseNamingStrategy implements PhysicalNamingStrategy {

@Override
public Identifier toPhysicalCatalogName(Identifier name, JdbcEnvironment jdbcEnvironment) {
return apply(name, jdbcEnvironment);
}

@Override
public Identifier toPhysicalSchemaName(Identifier name, JdbcEnvironment jdbcEnvironment) {
return apply(name, jdbcEnvironment);
}

@Override
public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment jdbcEnvironment) {
return apply(name, jdbcEnvironment);
}

@Override
public Identifier toPhysicalSequenceName(Identifier name, JdbcEnvironment jdbcEnvironment) {
return apply(name, jdbcEnvironment);
}

@Override
public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment jdbcEnvironment) {
return apply(name, jdbcEnvironment);
}

private Identifier apply(Identifier identifier, JdbcEnvironment jdbcEnvironment) {
if (identifier == null) {
return null;
}
return Identifier.toIdentifier(identifier.getText(), true);
}
}
4 changes: 2 additions & 2 deletions main/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ spring:
password: ${DEV_DB_PASSWORD}
jpa:
hibernate:
ddl-auto: validate
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
physical-strategy: org.sopt.makers.crew.main.common.config.CamelCaseNamingStrategy
ddl-auto: validate
properties:
hibernate:
show_sql: true
Expand Down

0 comments on commit 7a2a611

Please sign in to comment.