-
Notifications
You must be signed in to change notification settings - Fork 5
Entities
Andrew Horishnii edited this page Dec 1, 2015
·
2 revisions
- @ColumnAutoInc - used to set field as autoincrement. It applies only to the type of long or Long.class.
- @ColumnChild - used to set relationship (one to one, one to many).
- @ColumnDAO - used to save custom type object in the database.
- @ColumnIgnore - used to ignore this field.
- @ColumnName - used to set column name. Not required. Default used field name.
- @ColumnPrimaryKey - used to set field as primary key.
- @TableName - used to set table name. Not required. Default used class simple name.
Entity class need have private fields, and have default constructor. For example:
public class Artist {
@ColumnAutoInc private Long id;
private String name;
@ColumnChild(foreignKey = "artistId", parentKey = "id")
private List<TrackEntity> trackList;
public Artist() {
}
...
}@TableName("Track")
public class TrackEntity {
@ColumnPrimaryKey private long id;
private Long artistId;
@ColumnName("name") private String trackName;
private Date createdAt;
public TrackEntity() {
}
...
}