|
|
|
@ -7,6 +7,9 @@ import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
|
|
|
|
|
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
|
|
|
|
|
|
|
|
|
|
public class MyPhysicalNamingStrategy implements PhysicalNamingStrategy {
|
|
|
|
|
|
|
|
|
|
private static final String[] chars = new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Identifier toPhysicalCatalogName(Identifier name, JdbcEnvironment jdbcEnvironment) {
|
|
|
|
|
return name;
|
|
|
|
@ -19,7 +22,7 @@ public class MyPhysicalNamingStrategy implements PhysicalNamingStrategy {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment jdbcEnvironment) {
|
|
|
|
|
return Identifier.toIdentifier(StringUtils.camelToUnderline(name.getText()));
|
|
|
|
|
return Identifier.toIdentifier(StrUtil.toUnderlineCase(name.getText()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -29,11 +32,6 @@ public class MyPhysicalNamingStrategy implements PhysicalNamingStrategy {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment jdbcEnvironment) {
|
|
|
|
|
//用数组列出所有大写字母
|
|
|
|
|
String[] chars = new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
|
|
|
|
|
if (StrUtil.startWithAny(name.getText(), chars)) {
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
return Identifier.toIdentifier(StringUtils.camelToUnderline(name.getText()));
|
|
|
|
|
return Identifier.toIdentifier(StrUtil.toUnderlineCase(name.getText()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|