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: A Newbie question regarding composite key and <Join table
PostPosted: Mon Aug 11, 2008 6:00 am 
Newbie

Joined: Mon Aug 11, 2008 5:45 am
Posts: 15
I am new to NHIBERNATE. I have got a scenerio in which I have got two Domain Objects called

1. Message
2. Queue

and 3 Database tables called

1. Message
2. Queue
3. QueueMessage


As you would have guessed, I use QueueMessage to associate a Message to a Queue.

The QueueMessage table has got compositeId (MessageId,QueueId) and a field called Status.

In the Domain model Status field belongs to Message Class and it could be null if the message is not associated with any queue. But when the message is associated with a queue I need to populate the Doman.Message object from two database tables, similarly I need to update/save it in two tables (Message,QueueMessage).

I understand that in NHibernate 2.0 I could make use of <Join Table> element to join two tables but how could I use a composite key ?

My second question is that what is the best way to handle composite keys. Should I have a composite key or instead I replace it with an identity column ?

Your help is much appreciated.

Cheers,
Syed Askari


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.