Creating a Record

Examples of Record Creation

This class represents the record that will be stored in the database. It is also the class type that will be returned when getting records back from the database.

/**
 * <h1>Represents a customer</h1>
 */
public class Customer extends Record {

    @RecordFieldAnnotation(type = RecordFieldType.PRIMARY)
    public String uuid;

    public String name;

    /**
     * This field will not get saved to the database.
     */
    @RecordFieldIgnoreAnnotation
    public Object flag;
}
/**
 * <h1>Represents a purchase</h1>
 */
public class Purchase extends Record {

    @RecordFieldAnnotation(type = RecordFieldType.PRIMARY)
    public String uuid;

    @RecordFieldAnnotation(type = RecordFieldType.FOREIGN)
    @ForeignKeyAnnotation(table = "Customer", field = "uuid")
    public String customer;
}

Last updated