001package com.avaje.ebean.config;
002
003/**
004 * The JPA naming convention where column names match property names and table
005 * names match entity names.
006 * 
007 * <p>
008 * The JPA specification states that the in the case of no annotations the name
009 * of the class will be take as the table name and the name of a property will
010 * be taken as the name of the column.
011 * </p>
012 * 
013 * @author emcgreal
014 */
015public class MatchingNamingConvention extends AbstractNamingConvention {
016
017  /**
018   * Create with a sequence format of "{table}_seq".
019   */
020  public MatchingNamingConvention() {
021    super();
022  }
023
024  /**
025   * Instantiates with a specific format for DB sequences.
026   * 
027   * @param sequenceFormat
028   *          the sequence format
029   */
030  public MatchingNamingConvention(String sequenceFormat) {
031    super(sequenceFormat);
032  }
033
034  public String getColumnFromProperty(Class<?> beanClass, String propertyName) {
035    return propertyName;
036  }
037
038  public TableName getTableNameByConvention(Class<?> beanClass) {
039
040    return new TableName(getCatalog(), getSchema(), beanClass.getSimpleName());
041  }
042
043  public String getPropertyFromColumn(Class<?> beanClass, String dbColumnName) {
044    return dbColumnName;
045  }
046}