-->
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.  [ 4 posts ] 
Author Message
 Post subject: how do you generate a composite-id with xdoclet?
PostPosted: Sun Nov 27, 2005 1:43 am 
Regular
Regular

Joined: Mon Sep 29, 2003 9:39 am
Posts: 67
    xdoclet 1.2.3
    hibernate 3.0.5


Currently I'm using a separate component class, mapping properties in the component with @hibernate.property column="x_id", and @hibernate.id on the actual persistent class.

I'd like to map the composite id columns in the actual persistent class. I'm not quite sure if this is possible or how to do it. I've read a lot about this on the xdoclet JIRA, but I'm not quite sure where it stands. Someone suggested that xdoclet will interpret multiple @hibernate.id tags as a composite-id, and map the key-properties accordingly, but I haven't been able to get this to work. Has anyone succeeded in this?

Also, the rationale for doing this is simplicity - one less class. Is there a compelling reason to not do it? As others have mentioned before, this is a legacy schema that's somewhat off limits.
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 12:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Firstly, integrated Composite keys are NOT the recommended approach. So I would suggest you stay with using the external key class. If you are determined to have integrated keys and still use XDoclet then you will need to try out the CVS version of XDoclet [not sure if its complete as yet - check the test cases for examples].


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 12:25 pm 
Regular
Regular

Joined: Mon Sep 29, 2003 9:39 am
Posts: 67
Thanks, that answered my question. The reference mentions key components are better. This is because the separate key provides a 'handle' with it's own equals and hashCode methods?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 7:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Yes thats correct. Its also more consistent as session access is coded in the same approach as having just a single key. Less likely to make mistakes in your code base.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.