@OneToMany
@JoinColumn(name=”PART_ID”)
public Set getParts() { return parts; }
void setParts(Set parts) { this.parts = parts; }

Indexed Collections:
List:
OrderBy()
@OneToMany(mappedBy=”customer”)
@OrderBy(“number”)
public List getOrders() { return orders; }

Maps:
@OneToMany(mappedBy=”customer”)
@MapKey(name=”number”)
public Map getOrders() { return orders; }

SortedCollections
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
@JoinColumn(name=”CUST_ID”)
@Sort(type = SortType.COMPARATOR, comparator = TicketComparator.class)
public SortedSet getTickets() {
return tickets;
}

Bidirectional
1-m
m-n

Advertisements