hibernate 一对多单向xml配置方式
实体类:
public class Battery { private Integer id;//编号 private Set<BatteryVoltage> voltageList =new HashSet<>();
public class BatteryVoltage { private Integer id;//ID private Integer number;//编号 private Double voltage; //电压 private Integer equipmentID;//
xml:
<set name="voltageList" inverse="true" cascade="delete"> <key column="equipmentID"/> <one-to-many class="xdemo.entity.BatteryVoltage"/> </set>