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: *** many-to-many single field key***
PostPosted: Fri Aug 29, 2008 11:45 am 
Newbie

Joined: Tue Jun 10, 2008 12:39 pm
Posts: 14
Hi,

I have a Account and Detail tables with many-to-many association.I have link table AccountDetail.

Table 1:

Name : Account
Columns: account_id
account_name

Table 2:

Name: Detail
Columns : detail_id
detail_name

AccountDetail

Account_id
Detail_id
Name
description

In the link table both account_id+detail_id composite primary key

Queries :

1) I have created a .hbm.xml file for the link table.
I need to configure many-to-many in Account to Detail.
Can u please explain me how to configure <set> in account.
Issue is I have only account_id in the account table but key in the <set> needs to be both account_id and detail_id.

Thanks
Babu


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 01, 2008 9:49 am 
Regular
Regular

Joined: Tue Jul 29, 2008 3:30 am
Posts: 74
You have custom columns/properties in your link table, so why don't you use one-to-many references instead of many-to-many references?
You won't have a link entity with a many-to-many reference, so you won't be able to read/write Name and Description.

Unless you use both reference types, but I don't think that's best practice.


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.