Is it possible persist a map where the key is an entity and the value is a list of entities? Or do I need to invent a wrapper class to replace the list and persist that?
private Map<Customer, List<Purchase>> purchasesByCustomer = new HashMap<Customer, List<Purchase>>();
I've tried this, but I'm just guessing and it's not correct
@ManyToMany(targetEntity = Purchase.class, fetch = FetchType.EAGER) @IndexColumn(name = "pur_order") @Cascade(value = { org.hibernate.annotations.CascadeType.ALL }) public Map<Customer, List<Purchase>> getPurchasesByCustomer () { return purchasesByCustomer; }
p.s. Please forgive me if this question has been answered before, but the forum search didn't like these common terms which occur too many times to display (no surprise really :-) )
|