Documentation / Mapping / Naming convention
Naming convention
Ebean has a Naming Convention API to map column names to property names. It also maps entity to table names and can take into account database schema and catalog if required.
The default UnderscoreNamingConvention
converts column names with underscores into
normal java camel case property names (e.g. "first_name" maps to "firstName").
@Entity
@Table(name="be_contact")
public class Contact extends BaseModel {
...
// the default underscore naming convention maps
// "firstName" property to column "first_name"
// ... so this @Column annotation is not required
@Column(name="first_name")
String firstName;
Alternatively you can use the MatchingNamingConvention
or implement your own naming convention.
The MatchingNamingConvention names column names to match property names and table names to match entity names. Ebean follows the JPA specification which 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.