Annotation Interface Entity
Entities are simple POJOs that map to database rows. Field names are automatically converted to snake_case column names.
By default, the database table name is derived from the entity class name
(PascalCase → snake_case, with an optional Entity suffix stripped).
For example, UserSettingEntity → user_setting.
When automatic migration collides with a manually-managed table — for instance
because the manual SQL script uses a different naming convention — declare the
desired table name explicitly via tableName() to guarantee the
auto-migrator targets the same table as the manual scripts:
@Entity(tableName = "user_settings")
public class UserSettingEntity {
private Long id;
private Long userId;
// ...
}
When tableName is left empty (the default) the auto-migrator falls
back to the PascalCase → snake_case derivation described above.-
Optional Element Summary
Optional Elements
-
Element Details
-
tableName
String tableNameOptional explicit database table name for this entity.When empty (the default), the table name is derived from the entity class name (PascalCase → snake_case, with a trailing
Entitysuffix stripped).When non-empty, this exact name is used by the auto-migrator so the table it manages matches the one created or expected by manual migration scripts. The value must follow the same naming rules as
TableSchema.Builder— lowercase letters, digits, and underscores, starting with a lowercase letter, max 50 chars.- Returns:
- the explicit table name, or
""to derive from the class name
- Default:
""
-