-->
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.  [ 8 posts ] 
Author Message
 Post subject: one-to-many mapping with composite-id
PostPosted: Thu Feb 19, 2004 9:23 am 
Beginner
Beginner

Joined: Fri Feb 06, 2004 6:59 am
Posts: 36
Location: S
Hi folks,

I have a table named Zeitraum

Code:
[b]Zeitraum
----------
zeitID PK
schwackeCode PK[/b]



And I have a table named TypOption

Code:
[b]TypOption
------------
typSoaCode PK
zeitID normal field
schwackeCode normal field[/b]


I whould like to map a set one-to-many from Zeitraum to TypOption with the composite-id (zeitId and schwackeCode).....

How do I do this? I tried to search on the forum, read the manual but I can't get it to work.

_________________
Best Regards,
Ernani Joppert Pontes Martins


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 9:29 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
http://forum.hibernate.org/viewtopic.php?t=928147&highlight=compositeid

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 9:33 am 
Beginner
Beginner

Joined: Fri Feb 06, 2004 6:59 am
Posts: 36
Location: S
emmanuel wrote:


That's really nice, do you know how to do it with xdoclet?

_________________
Best Regards,
Ernani Joppert Pontes Martins


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 9:38 am 
Beginner
Beginner

Joined: Fri Feb 06, 2004 6:59 am
Posts: 36
Location: S
ernani wrote:
emmanuel wrote:


That's really nice, do you know how to do it with xdoclet?


Sorry but I got it wrong, thats not nice, your answer was different of my example, I want to map from table zeitraum (zeitId, schwackeCode) to typOption(zeitId, schwackeCode) not a single field but a composite field.

And please if you know how to do it with xdoclet I whould be very very thankfull....

_________________
Best Regards,
Ernani Joppert Pontes Martins


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 12:44 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Code:
      <set name="logs" inverse="true">
         <key>
           <column name="auctionid"/>
           <column name="auctionid2"/>
<!-- keep the same order than in the composite-id
         </key>

         <one-to-many class="BidOnItemLog"/>
       </set>
   </class>
</hibernate-mapping>

<hibernate-mapping>
   <class name="com.twofi.auction.objects.BidOnItemLog" table="auctionitem">
      <composite-id unsaved-value="any">
         <key-many-to-one class="Auction">
           <column name="auctionid"/>
           <column name="auctionid2"/>
         </key-many-to-one>
      </composite-id>
   </class>
</hibernate-mapping>

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 1:21 pm 
Beginner
Beginner

Joined: Fri Feb 06, 2004 6:59 am
Posts: 36
Location: S
Thanks Emmanuel...

I was wondering where can I find a way to provide this with xdoclet....

Does anybody here knows how?

_________________
Best Regards,
Ernani Joppert Pontes Martins


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 19, 2004 1:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No, XDoclet does not support composite ids which are not a seperate class.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2004 6:00 am 
Beginner
Beginner

Joined: Fri Feb 06, 2004 6:59 am
Posts: 36
Location: S
gloeglm wrote:
No, XDoclet does not support composite ids which are not a seperate class.


Thanks Michael, I will do my best to try to code a generator then.

_________________
Best Regards,
Ernani Joppert Pontes Martins


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