1、在创建后新建一个视图
2、将视图中含有的字段,都创建为实体类bean;
3、由于视图没有主键,但是在java bean实体当中需要有该主键,所以需要找到视图中的不重复的字段作为主键
利用annotation注解的映射方法和普通的映射一样;示例:
@Entity
@Table(name = "INVERTORY_SPLIT")
public class InvertorySplit extends IdEntity implements java.io.Serializable {
private static final long serialVersionUID = 1L;
// 清单号
private String inventoryId;
public String getInventoryId() {
return inventoryId;
}
public void setInventoryId(String inventoryId) {
this.inventoryId = inventoryId;
}
// 车辆标识
private String wagonId;
// 车辆车号
private String wagonCode;
// 车辆吨数
private Integer wagonWeight;
//清单编号
private String inverntoryNumber;
public String getWagonId() {
return wagonId;
}
public void setWagonId(String wagonId) {
this.wagonId = wagonId;
}
public String getInverntoryNumber() {
return inverntoryNumber;
}
public void setInverntoryNumber(String inverntoryNumber) {
this.inverntoryNumber = inverntoryNumber;
}
}