I have a question that I am trying to solve in applying Hibernate/Annotations, is it of one-many and many-many associations or something else.
If I have three classes that I want to persist:
The top class is e.g., 1) SimModel - only one of these exists during run time.
second class 2) PlatformList - -- public class PlatformList extends LinkedList<PlatformModel> {..
third is 3) PlatformModel - e.g. identifies a vehicle object
And I declare PlatformList as an array in SimModel, ie, PlatformLists[ ] platforms, the array will hold two platform lists, e.g Red, containing red platforms ; and Blue, containting blue platforms, ie, :
public class SimModel implements Serializable {
public static int RED = 0;
public static int BLUE = 1;
private PlatformList[ ] platforms;
..
public SimModel() {
platforms = new PlatformList[2]; //array of two lists Red and Blue
platforms[RED] = new PlatformList();
platforms[BLUE] = new PlatformList();
}
..
}
There are many unique PlatformModel objects in the Red and Blue list objects.
My Question is would SimModel have a 1:1 relationship with PlatformList or 1 : many relationship, since its declared as an array in SimModel??
Do I need to use Collections of element annotations?? and help on how to proceed with this is appreciated from Newbie.
|