I have an object that I call BaseObject
which all classes that are persisted extend. This class has an _id
field, dateCreated
, dateModified
, etc.... The database tables that correspond to all objects that extends this base object obviously have columns that store these values.
How can I set up these fields using annotations so all these fields are persisted to the database? Can I do this or will I need to add these fields to the POJOs directly? I have included below my base object and one of the classes that extends it.
public class BaseObject {
private int _id;
private String dateCreated;
private String dateModified;
private String createModule;
private String modifiedModule;
// getters and setters here ...
}
Here's the super-class:
@DatabaseTable(tableName = "FOOD")
public class Food extends BaseObject {
public Food(int foodGroupId, String longDescription) {
this.foodGroupId = foodGroupId;
this.longDescription = longDescription;
}
private Integer foodGroupId;
private String longDescription;
// getters and setters here ...
}
Any help would be appreciated. Thank you.