Module io.ebean.api

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
  • Constructor Details

    • 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 Details

    • 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)
      Description copied from class: AbstractNamingConvention
      Return the tableName using the naming convention (rather than deployed Table annotation).
      Specified by:
      getTableNameByConvention in class AbstractNamingConvention
    • 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 column
      fkProperty - the property name of the foreign key
      Returns:
      the foreign key column