我有一个驱动程序类:
public class Driver {
private String driverId;
private String driverName;
//getter and setter
}
和一个 DriverEntry 类,用于存储驾驶员日常驾驶详细信息,DriverEntry 类具有 DriverEntryKey,其中包含 Driver 对象和 Date 对象。那么如何在 driver.hbm.xml 文件中映射这些文件呢?
public class DriverEntry {
private DriverEntryKey key;
private String startTime;
private String endTime;
//getter and setter
}
public class DriverEntryKey implements Serializable{
private Driver driver;
private Date date;
}
<class name="Driver" table="driver" >
<id name="driverId" column="driver_id">
<generator class="assigned"/>
</id>
<property name="driverName" column="prod_name" length="20"/>
</class>
<class name="DriverEntry" table="DriverEntry" >
<composite-id name="key" class="DriverEntryKey">
<key-property name="driver" type=""></key-property>
<key-property name="date" type=""></key-property>
</composite-id>
</class>
那么我可以在里面填写什么维护驱动程序---主键到外键---在---> DataEntry 表?