-->
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: Composite id example
PostPosted: Thu Oct 16, 2003 9:10 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
Hi,

I have a composite id with a composite key class like that

Code:
<class name="Foo" table="foo">
  <composite-id name="comp_id" class="FooPK">
    <key-property name="foo1"/>
    <key-many-to-one name="bar class="Bar"/>
  </composite-id>
</class>


What do I have to put in both Foo and FooPK classes?
Can I have get/setBar methods in the Foo class ?
When I use hbm2java these accessors are only in the FooPK class but I would like to have them in the Foo class. If I want to do so, do I have to implement them with delegate to FooPK i.e. :

Code:
public Bar getBar()
{
  return comp_id.getBar();
}
public void setBar(Bar a_bar)
{
  comp_id.setBar(a_bar);
}


or do I have to dupicate the bar attribute in the Foo class (but in this case which attribute is saved ?).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2003 9:54 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Delegate


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.