Class 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 Detail

      • MatchingNamingConvention

        public MatchingNamingConvention​(String sequenceFormat)
        Instantiates with a specific format for DB sequences.
        Parameters:
        sequenceFormat - the sequence format
    • Method Detail

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