magnetfruit_entity

Domain model definition. Used by various magnetfruit programs.


License
GPL-3.0

Documentation

Entity

Entity definition. Used by various magnetfruit programs. They provide all the information needed by the avocadorm to talk to a database, so there is no need for extra configuration files.

Creating an entity

An entity is simply a domain model class that extends from Entity, and that is annotated with a few metadata.

part of entities;

@Table('employee')
class Employee extends Entity {

  @Column.PrimaryKey('employee_id')
  int employeeId;

  @Column('name')
  String name;

  @Column('company_id')
  int companyId;

  @Column.ManyToOneForeignKey('companyId')
  Company company;

  @Column.OneToManyForeignKey('employeeId')
  List<Project> projects;

} 

Visit the homepage for information about entities, properties, and entity libraries.