In this code, how to generate a Java class for the composite key (how to composite key in hibernate):
create table Time (
levelStation int(15) not null,
Another option is to map is as a Map of composite elements in the ConfPath table.
This mapping would benefit from an index on (ConfPathID,levelStation) though.
public class ConfPath {
private Map timeForLevelStation = new HashMap();
public Time getTime(long levelStation) {
return timeForLevelStation.get(levelStation);
}
public void putTime(long levelStation, Time newValue) {
timeForLevelStation.put(levelStation, newValue);
}
}
public class Time {
String src;
String dst;
long distance;
long price;
public long getDistance() {
return distance;
}
public void setDistance(long distance) {
this.distance = distance;
}
public String getDst() {
return dst;
}
public void setDst(String dst) {
this.dst = dst;
}
public long getPrice() {
return price;
}
public void setPrice(long price) {
this.price = price;
}
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
}
Mapping: