OK, I have the following objects
InsuranceSearchData
Driver
Vehicle
Incident
InsuranceSearchData can have zero or more Drivers (List<Driver>), and zero or more Vehicles (List<Vehicle>).
A Vehicle has a primary driver and a list of zero or more secondary drivers (List<Driver>), but should be able to be saved before the primary driver is set.
A Driver as zero or more incidents (List<Incident>)
For business reasons, the data should be able to be saved to the database as information is entered, which means that a Vehicle will be saved before its drivers are set, a Drier will be saved before its incidents are set, etc.
The schema is auto-generated using hibernatetool
I'd annotated them as follows (leaving out much of the other detail):
Code:
InsuranceSearchData:
@CollectionOfElements
private List<Driver> driverList;
@CollectionOfElements
private List<Vehicle> vehicleList;
Driver:
@OneToMany
private List<Incident> incidentList;
Vehicle:
@ManyToOne
private Driver primaryDriver;
@ManyToMany
private List<Driver> secondaryDriver;
I'm assuming I need some additional annotations to make everything work. Any ideas here?[/code]