In my application design I have a table to hold entity instances and a separate table to hold the entity status, like...
Code:
Entity
-------
EntityID int
EntityName varchar(50)
EntityAlias varchar(20)
EntityStatus
------------
StatusID int
EntityID int
StatusDate timestamp
StatusDescription varchar(50)
StatusChangeReason varchar(200)
public class Entity {
private int fID;
private String fName;
private String fAlias;
...
...
}
public class EntityStatus {
private int fID;
private int fEntityID
private Date fDate
private String fDesc;
private String fReason;
...
...
}
Hence, a single instance in the 'Entity' table can have multiple data instances in the 'EntityStatus' table.
I want to create a composite object that represents the entity plus its latest status like...
Code:
public class EntityInfo extends Entity {
private EntityStatus fLatestStatus;
...
...
}
The latest status field would represent the entry in the 'EntityStatus' table with the most recent 'StatusDate' field.
How would I go about mapping the 'fLatestStatus' object field?