Hi,
I have the following interfaces and classes.
Code:
interface Instruction {
public String getId();
public String getDescription();
public void setDescription(String description);
public Collection getUnits();
public void addUnit(Unit unit);
public void removeUnit(Unit unit);
...
}
interface Unit {
public String getId();
...
}
class InstructionImpl implements Instruction {
private String id;
private String description;
public InstructionImpl() {}
public InstructionImpl(String description) {
this.description = description;
}
public String getId() {
return id;
}
...
}
class UnitImpl implements Unit {
...
}
The existing table structure is:
Code:
create table INSTRUCTION (
id VARCHAR(32) NOT NULL PRIMARY KEY,
description VARCHAR(255) NOT NULL
)
create table UNIT (
id VARCHAR(32) NOT NULL PRIMARY KEY,
description VARCHAR(255) NOT NULL
)
What kind of mapping can I use, given that I need a one-to-many relationship between Instruction and Unit, therefore, making table-per-concrete-class not an option? I also cannot modify the table structure.
Thanks in advance.