package org.kitchenstudio.model;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;

@Entity
public class Order {

	@Id
	@GeneratedValue
	private Long id;

	private String date;

	private int isOut;// 0代表进料单，1代表出料单
	
	//ManyToOne
	//private 项目
	private String handler;// 经手人

	private String renter;// 出租方

	private String lessee;// 承租方

	private Set<OrderItem> orderItems;//多个订单项
//	@OneToMany(targetEntity=org.kitchenstudio.model.OrderItem.class, 
//            mappedBy="order")
	@OneToMany(orphanRemoval=true)
	@JoinColumn(name="ORDER_ID", nullable=false)
	public Set<OrderItem> getOrderItems() { return orderItems; }
	
	public void setOrderItems(Set<OrderItem> orderItems) {
		this.orderItems = orderItems;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public int getIsOut() {
		return isOut;
	}

	public void setIsOut(int isOut) {
		this.isOut = isOut;
	}

	public String getHandler() {
		return handler;
	}

	public void setHandler(String handler) {
		this.handler = handler;
	}

	public String getRenter() {
		return renter;
	}

	public void setRenter(String renter) {
		this.renter = renter;
	}

	public String getLessee() {
		return lessee;
	}

	public void setLessee(String lessee) {
		this.lessee = lessee;
	}


	// private Driver;
	// private plateNumber;
	// private 单子的状态 ：刚刚创建，正在装货，在途，到达
	//

}

@@ -361,13 +361,13 @@
 %E5%87%BA%E6%96%99%E5%8D%95%0A
-%09
 %0A%09//
+ 
 Many
@@ -375,16 +375,17 @@
 oOne%0A%09//
+ 
 private 
@@ -485,152 +485,8 @@
 %E7%A7%9F%E6%96%B9%0A%0A
-%09private Set%3COrderItem%3E orderItems;//%E5%A4%9A%E4%B8%AA%E8%AE%A2%E5%8D%95%E9%A1%B9%0A//%09@OneToMany(targetEntity=org.kitchenstudio.model.OrderItem.class, %0A//            mappedBy=%22order%22)%0A
 %09@On
@@ -506,17 +506,19 @@
 nRemoval
-=
+ = 
 true)%0A%09@
@@ -532,17 +532,19 @@
 umn(name
-=
+ = 
 %22ORDER_I
@@ -559,16 +559,63 @@
 able
-=
+ = 
 false)%0A
+%09private Set%3COrderItem%3E orderItems;// %E5%A4%9A%E4%B8%AA%E8%AE%A2%E5%8D%95%E9%A1%B9%0A%0A
 %09pub
@@ -650,17 +650,19 @@
 tems() %7B
- 
+%0A%09%09
 return o
@@ -675,12 +675,12 @@
 ems;
- 
+%0A%09
 %7D%0A
-%09
 %0A%09pu
@@ -1430,17 +1430,16 @@
 ee;%0A%09%7D%0A%0A
-%0A
 %09// priv

解决 ORM 映射（订单）