Package io.ebean.config
Class MatchingNamingConvention
- 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
DEFAULT_SEQ_FORMAT
-
-
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 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.TableName
getTableNameByConvention(Class<?> beanClass)
-
Methods inherited from class io.ebean.config.AbstractNamingConvention
deriveM2MColumn, getCatalog, getM2MJoinTableName, getSchema, getSequenceFormat, getSequenceName, getTableName, getTableName, isUseForeignKeyPrefix, loadFromProperties, 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:NamingConvention
Return the column name given the property name.- Returns:
- the column name for a given property
-
getTableNameByConvention
public TableName getTableNameByConvention(Class<?> beanClass)
-
getForeignKey
public String getForeignKey(String prefix, String fkProperty)
Description copied from interface:NamingConvention
Return 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
-
-