com.avaje.ebean.config
Class MatchingNamingConvention
java.lang.Object
com.avaje.ebean.config.AbstractNamingConvention
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
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 |
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
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.