- java.lang.Object
-
- io.ebean.config.AbstractNamingConvention
-
- io.ebean.config.MatchingNamingConvention
-
- All Implemented Interfaces:
NamingConvention
public class MatchingNamingConvention extends AbstractNamingConvention
The JPA naming convention where column names match property names and table names match entity names.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.
- Author:
- emcgreal
-
-
Field Summary
-
Fields inherited from class io.ebean.config.AbstractNamingConvention
databasePlatform, DEFAULT_SEQ_FORMAT, rhsPrefixLength, useForeignKeyPrefix
-
-
Constructor Summary
Constructors Constructor Description MatchingNamingConvention()Create with a sequence format of "{table}_seq".MatchingNamingConvention(String sequenceFormat)Instantiates with a specific format for DB sequences.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetColumnFromProperty(Class<?> beanClass, String propertyName)Return the column name given the property name.StringgetForeignKey(String prefix, String fkProperty)Return the foreign key column given the local and foreign properties.TableNamegetTableNameByConvention(Class<?> beanClass)Return the tableName using the naming convention (rather than deployed Table annotation).-
Methods inherited from class io.ebean.config.AbstractNamingConvention
deriveM2MColumn, getCatalog, getM2MJoinTableName, getSchema, getSequenceFormat, getSequenceName, getTableName, getTableName, getTableNameFromAnnotation, hasInheritance, isEmpty, isUseForeignKeyPrefix, loadFromProperties, quoteIdentifiers, setCatalog, setDatabasePlatform, setSchema, setSequenceFormat, setUseForeignKeyPrefix
-
-
-
-
Constructor Detail
-
MatchingNamingConvention
public MatchingNamingConvention()
Create with a sequence format of "{table}_seq".
-
MatchingNamingConvention
public MatchingNamingConvention(String sequenceFormat)
Instantiates with a specific format for DB sequences.- Parameters:
sequenceFormat- the sequence format
-
-
Method Detail
-
getColumnFromProperty
public String getColumnFromProperty(Class<?> beanClass, String propertyName)
Description copied from interface:NamingConventionReturn the column name given the property name.- Returns:
- the column name for a given property
-
getTableNameByConvention
public TableName getTableNameByConvention(Class<?> beanClass)
Description copied from class:AbstractNamingConventionReturn the tableName using the naming convention (rather than deployed Table annotation).- Specified by:
getTableNameByConventionin classAbstractNamingConvention
-
getForeignKey
public String getForeignKey(String prefix, String fkProperty)
Description copied from interface:NamingConventionReturn the foreign key column given the local and foreign properties.- Parameters:
prefix- the local column used to prefix the fk columnfkProperty- the property name of the foreign key- Returns:
- the foreign key column
-
-