-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Is it possible to have a Map<Entity, List<Entity>> ?
PostPosted: Tue May 26, 2009 4:39 am 
Newbie

Joined: Tue May 23, 2006 12:46 pm
Posts: 17
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 :-) )


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.