-->
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: Legacy Mapping foreign composite key with partial data.
PostPosted: Fri Aug 17, 2007 5:38 pm 
Newbie

Joined: Tue May 01, 2007 10:20 am
Posts: 9
Hi all.

I'm using NHibernate 1.2 GA, but am willing to go to a more recent build if necessary.

I have the following table structure in a legacy database I'm trying to map...


Table: TextInstruction
Composite key:
ID-Revision-Sequence


Table: TextInstructionLine
Composite key:
ID-Revision-Sequence

Now, these ID-Revision-Sequences are not the same. Basically, when a user starts a job, they can have multiple instructions. Each instruction has an ID and Rev, and for a specific job they might have more than one instruction, whose order is represented by the sequence. These are the keys for TextInstruction.

TextInstructionLine contains the actual lines that make up the text. The sequence is the line number. Please, hold your laughter.

So, basically, one Instruction (table not shown) can have multiple TextInstructions in a sequence, each having multiple lines.

Ok, if the TextInstructionLine was properly set up and had the foreign keys for the TextInstruction, I'd be golden, but instead, the TextInstruction table has LineID and LineRev columns, which is used to find all the lines, and order them by the sequence.

So, in other words, the containing table holds the foreign keys, and due to the fact that the key is composite but the table doesn't store everything, it's not even the complete key at that.

Any ideas how I can go about this so I can still have an IList<string> or IList<TextInstructionLine> in my TextInstruction domain class? I have an alternate plan to keep them seperate and do all the creating in the task layer, which would be a pain, but at least something if no one else has any ideas...

Thanks in advanced.


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.