-->
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.  [ 2 posts ] 
Author Message
 Post subject: question about new elements and maps
PostPosted: Mon Jan 26, 2004 5:30 pm 
Newbie

Joined: Tue Nov 11, 2003 6:24 pm
Posts: 17
My appologies if this has been answered before but I can't seem to find anything on this topic.

If I map my one-to-many collection as a map, how are new elements represented? Do I simply call put on my map and insert a null key? I'm thinking my Java code would look something like this.

Am I on the right track or do I have to stick with Sets to represent new values?

Code:
{
Order oder = new Order();
LineItem item = new LineItem();
Map lineItems = new HashMap();
,,,
item.setOrder(order);
lineitems.put(null, item);
order.setLineItems(lineItems);
...
session.saveOrUpdate(order);
}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 5:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You just call put just like you would call add on a Set, Hibernate handles this for you.


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

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.