org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
> select t.team_id, t.name from tb_team t where t.team_id = 1;
package me.kevin.configuration;
import org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy;
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import java.util.Locale;
public class CamelCaseToSnakeAndUpperCaseStrategy extends CamelCaseToUnderscoresNamingStrategy {
@Override
protected Identifier getIdentifier(String name, final boolean quoted, final JdbcEnvironment jdbcEnvironment) {
if ( isCaseInsensitive( jdbcEnvironment ) ) {
name = name.toUpperCase( Locale.ROOT );
}
return new Identifier( name, quoted );
}
}
jpa:
properties:
hibernate:
physical_naming_strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
// ... 또는
physical_naming_strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
jpa:
properties:
hibernate:
physical_naming_strategy: me.kevin.configuration.CamelCaseToSnakeAndUpperCaseStrategy
> select t.team_id, t.name from tb_team t where t.team_id = 1;
> select t.TEAM_ID, t.NAME from TB_TEAM t where t.TEAM_ID = 1;