I've read the docs and searched the forums and can't find an answer to this particular problem
I have two entities like....
Code:
public class BuildingDesign {
....
private int fID;
private String fTitle;
....
}
public class BuildingDesignLock {
...
private int fLockID;
private int fBuildingDesignID;
private String fUserID;
...
}
CREATE TABLE `building_design` (
`BuildingDesignID' int(11) NOT NULL auto_increment,
`BuildingDesingTItle` varchar(50) NOT NULL,
PRIMARY KEY (`BuildingDesignID`),
)
CREATE TABLE `building_design_lock` (
`LockID' int(11) NOT NULL auto_increment,
`BuildingDesignID' int(11) NOT NULL,
PRIMARY KEY (`LockID`),
UNIQUE KEY `BuildingDesignID (`BuildingDesignID`))
The 'lock' entity is optional and used to hold the name of a user that has placed a write lock over building design entity.
There is a 1 to 1/0 link (i.e. optional one-to-one) link from BuildingDesign to BuildingDesignLock.
I want to display a list of the building designs with their lock status. For this I've created a descendant class like...
Code:
public class BuildingDesignInfo extends BuildingDesign {
....
private BuildingDesingLock fLock;
....
}
.... but in none of the examples can I find a way of defining an optional one to one association where the link is a foreign key in the second table.
Can this be done?
[/code]