-->
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: Using components as composite identfiers
PostPosted: Tue Jan 24, 2006 3:15 pm 
Newbie

Joined: Thu Oct 27, 2005 6:01 pm
Posts: 15
Hi all,

I have a question regarding the use of components as composite ids (as described in Section 8.4 of the documentation) Does this approach suppose that the setter of the property containing an associated object also set the related property in the id component?

In other words, is this how it's supposed to work (see code below, using the example in the doc)?

Code:
public class OrderLineId {
   ...
   public setLineId(int lineId){...}
   public setOrderId(int orderId){...}
   public setCustomerId(int customerId){...}
}

public class OrderLine {
   ...
   public setId(OrderLineId id){...}
   public setOrder(Order order){
      this.order = order;
      this.id.setOrderId(order.getId());
   }
}



Or am I supposed to set those two properties separately every time i want to update the order property, even though the two properties essentially hold the same thing?

Thanks.
Eugene


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.