用hibernate建了三张表,分别为goods、orderform、client。orderform和client简成功了 goods失败但是就是不报错,代码如下:
goods:@Entity
@Table(name="goods")
public class Goods {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int id;
private String name;
private String material;
private String place;
private double price;
private String unit;
private int number;
private String type;
private String theFile;
@ManyToMany(cascade=CascadeType.ALL)
@JoinTable(name="orderform_goods")
private List<OrderForm> orderform = new ArrayList<OrderForm>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getMaterial() {
return material;
}
public void setMaterial(String material) {
this.material = material;
}public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public void setPrice(double price) {
this.price = price;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<OrderForm> getOrderform() {
return orderform;
}
public void setOrderform(List<OrderForm> orderform) {
this.orderform = orderform;
}
public String getTheFile() {
return theFile;
}
public void setTheFile(String theFile) {
this.theFile = theFile;
}
}client:
@Entity
@Table(name="client")
public class Client {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int id;
private String name;
private String password;
private String telephone;
private String post_code;
private String address;
@OneToMany(mappedBy="client",cascade=CascadeType.ALL)
private List<OrderForm> orderform = new ArrayList<OrderForm>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getPost_code() {
return post_code;
}
public void setPost_code(String post_code) {
this.post_code = post_code;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public List<OrderForm> getOrderform() {
return orderform;
}
public void setOrderform(List<OrderForm> orderform) {
this.orderform = orderform;
}
}
orderform:
@Entity
@Table(name="orderform")
public class OrderForm {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private int id;
@Temporal(value=TemporalType.DATE)
private Date order_date;
private String name;
private String deliver_address;
private String tel;
private String receive_name;
@ManyToOne(cascade=CascadeType.ALL)
@JoinColumn(name="client_id")
private Client client;
@ManyToMany(mappedBy="orderform",cascade=CascadeType.ALL)
private List<Goods> goods=new ArrayList<Goods>();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getOrder_date() {
return order_date;
}
public void setOrder_date(Date order_date) {
this.order_date = order_date;
}
public String getDeliver_address() {
return deliver_address;
}
public void setDeliver_address(String deliver_address) {
this.deliver_address = deliver_address;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public String getReceive_name() {
return receive_name;
}
public void setReceive_name(String receive_name) {
this.receive_name = receive_name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}public Client getClient() {
return client;
}
public void setClient(Client client) {
this.client = client;
}
public List<Goods> getGoods() {
return goods;
}
public void setGoods(List<Goods> goods) {
this.goods = goods;
}

配置文件如下:
<hibernate-configuration>  <session-factory>
  <property name="hibernate.show_sql">true</property>
<property name="hbm2ddl.auto">update</property>
  <property name="connection.username">scott</property>
  <property name="connection.url">jdbc:oracle:thin:@127.0.0.1:1521:oracle</property>
  <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
  <property name="create">true</property>
  <property name="connection.password">tiger</property>
  <property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
  <mapping class="com.web.bean.OrderForm"/>
  <mapping class="com.web.bean.Goods"/>
  <mapping class="com.web.bean.Client"/>
   
   
  </session-factory></hibernate-configuration>