3
當我們在@OneToMany中使用mappedBy註釋時,我們是否提到了類名或表名?mappedBy是指類名或表名?
個例:
@Entity
@Table(name = "customer_tab")
public class Customer {
@Id @GeneratedValue public Integer getId() { return id; }
public void setId(Integer id) { this.id = id; }
private Integer id;
@OneToMany(mappedBy="customer_tab")
@OrderColumn(name="orders_index")
public List<Order> getOrders() { return orders; }
}
所以這兩個是正確的? :
- @OneToMany(的mappedBy = 「customer_tab」)
- @OneToMany(的mappedBy = 「客戶」)?
謝謝!
啊!這就是爲什麼我得到註釋錯誤!謝謝 – taboubim