标签:主键 spring upper 下划线 rate ide image return 使用
所在类的同级包,以及下级包里的所有BEAN。
bankuserId ----> bankuser_id
#无修改策略
#spring.jpa.hibernate.naming.physical-strategy =
org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
#驼峰命名的修改下划线的策略配置
#spring.jpa.hibernate.naming.physical-strategy =
org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
1)重写命名策略中改表名为小写的方法:
import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
public class SpringPhysicalNamingTableUpStrategy extends SpringPhysicalNamingStrategy {
@Override
public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) {
String tableName = name.getText().toUpperCase();
return name.toIdentifier(tableName);
}
}
spring.jpa.hibernate.naming.physical-strategy=com.xxx.xxx.
SpringPhysicalNamingTableUpStrategy
标签:主键 spring upper 下划线 rate ide image return 使用
原文地址:https://www.cnblogs.com/SacredOdysseyHD/p/9278766.html