日期:2014-05-19 浏览次数:20597 次
package com.model;
import java.sql.Date;
import java.util.HashMap;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;
@Entity
public class Order_form {
private int id;
private Date buy_time;
private User user;
private HashMap<Good, Integer> form = new HashMap<Good, Integer>();
public Date getBuy_time() {
return buy_time;
}
public void setBuy_time(Date buy_time) {
this.buy_time = buy_time;
}
@ManyToOne
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
@OneToMany(cascade=CascadeType.ALL)
@MapKey(name="id")
public HashMap<Good, Integer> getForm() {
return form;
}
public void setForm(HashMap<Good, Integer> form) {
this.form = form;
}
@Id
@GeneratedValue
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}