com.avaje.ebean.config
Class MatchingNamingConvention

java.lang.Object
  extended by com.avaje.ebean.config.AbstractNamingConvention
      extended by com.avaje.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 com.avaje.ebean.config.AbstractNamingConvention
DEFAULT_SEQ_FORMAT
 
Constructor Summary
MatchingNamingConvention()
          Create with a sequence format of "{table}_seq".
MatchingNamingConvention(String sequenceFormat)
          Instantiates with a specific format for DB sequences.
 
Method Summary
 String getColumnFromProperty(Class<?> beanClass, String propertyName)
          Return the column name given the property name.
 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).
 
Methods inherited from class com.avaje.ebean.config.AbstractNamingConvention
getCatalog, getM2MJoinTableName, getSchema, getSequenceFormat, getSequenceName, getTableName, isUseForeignKeyPrefix, setCatalog, setDatabasePlatform, setSchema, setSequenceFormat, setUseForeignKeyPrefix
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)
Description copied from class: AbstractNamingConvention
Return the tableName using the naming convention (rather than deployed Table annotation).


getPropertyFromColumn

public String getPropertyFromColumn(Class<?> beanClass,
                                    String dbColumnName)
Description copied from interface: NamingConvention
Return the property name from the column name.

This is used to help mapping of raw SQL queries onto bean properties.

Parameters:
beanClass - the bean class
dbColumnName - the db column name
Returns:
the property name from the column name


Copyright © 2010. All Rights Reserved.