@ManyToOne(optional=false)
@JoinColumn(name="CUST_ID", nullable=false, updatable=false)
public Customer getCustomer() { return customer; }
http://download.oracle.com/javaee/6/api/javax/persistence/OneToMany.html
@OneToMany(cascade=ALL, mappedBy="customer")
public Set
the first is always "me", the second is "the other"
ManyToOne means "there are many of me for one of them" -> hence I have only 1 of them, and he has a Set of me
OneToMany means "there is one of me for many of them" -> hence I have a Set of them
http://download.oracle.com/javaee/6/api/javax/persistence/ManyToMany.html
@ManyToMany
@JoinTable(name="CUST_PHONES")
public Set
I have a Set of them, and they have a Set of me
No comments:
Post a Comment