I have a project design for 'Project' and 'Project status' as follows:
Code:
public class Project {
long ID;
String Title
...
...
}
public class ProjectStatus {
long ProjectID;
String StatusDescription;
Date ChangeDate;
...
}
There are two tables: one for 'Project', a second for 'ProjectStatus'. A project's status can change over time, so for each record in the 'Project' table there might be multiple related entries in the 'ProjectStatus' table.
My question is from a Hibernate perspective how can I include the 'latest' status as part of the 'Project' class definition?
In other words I don't want...
Code:
public class Project {
long ID;
String Title
...
...
ArrayList<ProjectStatus> StatusList;
}
Instead I'm looking for....
Code:
public class Project {
long ID;
String Title
...
...
ProjectStatus LatestStatus;
}
The 'LatestStatus' is the project related entry in the 'ProjectStatus' table with the most recent date.
Any suggestions?