/** Set the naming convention to underscore if it has not already been set. */ private void setNamingConvention(ServerConfig config) { if (config.getNamingConvention() == null) { UnderscoreNamingConvention nc = new UnderscoreNamingConvention(); config.setNamingConvention(nc); String v = config.getProperty("namingConvention.useForeignKeyPrefix"); if (v != null) { boolean useForeignKeyPrefix = Boolean.valueOf(v); nc.setUseForeignKeyPrefix(useForeignKeyPrefix); } String sequenceFormat = config.getProperty("namingConvention.sequenceFormat"); if (sequenceFormat != null) { nc.setSequenceFormat(sequenceFormat); } } }
/** * Converts a field name to a table name. example: aFieldName -> a_field_name * * @param fieldName * @return The table name. */ private String getTableName(java.lang.Class<?> modelClass, String fieldName) { UnderscoreNamingConvention nameConvention = new UnderscoreNamingConvention(); return nameConvention.getColumnFromProperty(modelClass, fieldName); }