public class MatchingNamingConvention extends AbstractNamingConvention
The JPA specification states that the in the case of no annotations the name of the class will be take as the table name and the name of a property will be taken as the name of the column.
DEFAULT_SEQ_FORMAT
Constructor and Description |
---|
MatchingNamingConvention()
Create with a sequence format of "{table}_seq".
|
MatchingNamingConvention(String sequenceFormat)
Instantiates with a specific format for DB sequences.
|
Modifier and Type | Method and Description |
---|---|
String |
getColumnFromProperty(Class<?> beanClass,
String propertyName)
Return the column name given the property name.
|
String |
getForeignKey(String prefix,
String fkProperty)
Return the foreign key column given the local and foreign properties.
|
String |
getPropertyFromColumn(Class<?> beanClass,
String dbColumnName)
Return the property name from the column name.
|
TableName |
getTableNameByConvention(Class<?> beanClass)
Return the tableName using the naming convention (rather than deployed
Table annotation).
|
getCatalog, getM2MJoinTableName, getSchema, getSequenceFormat, getSequenceName, getTableName, isUseForeignKeyPrefix, loadFromProperties, setCatalog, setDatabasePlatform, setSchema, setSequenceFormat, setUseForeignKeyPrefix
public MatchingNamingConvention()
public MatchingNamingConvention(String sequenceFormat)
sequenceFormat
- the sequence formatpublic String getColumnFromProperty(Class<?> beanClass, String propertyName)
NamingConvention
public TableName getTableNameByConvention(Class<?> beanClass)
AbstractNamingConvention
public String getPropertyFromColumn(Class<?> beanClass, String dbColumnName)
NamingConvention
This is used to help mapping of raw SQL queries onto bean properties.
beanClass
- the bean classdbColumnName
- the db column namepublic String getForeignKey(String prefix, String fkProperty)
NamingConvention
prefix
- the local column used to prefix the fk columnfkProperty
- the property name of the foreign keyCopyright © 2019. All rights reserved.