Hi All. I'm using NHibernate 1.2, though don't have problems going to trunk if necessary.
I've posted this problem
before, thought I'd try again.
I have the following structure with composite keys in a legacy database
Code:
Table: Text
*KEY* ID
*KEY* Rev
*KEY* Sequence
TextLinesID
TextLinesRev
Table: TextLines:
*KEY* ID
*KEY* Rev
*KEY* Sequence
Data
Ignore the Key for Text, as that has nothing to do this at all, and does not pertain to the TextLines keys.
Each Text has a list of Data, which is found by looking at the TextLineID and TextLineRev columns, and getting all the rows in TextLines with that ID and Rev. The results are ordered by the Sequence column in the TextInstructionData table. Here is a sql statement to return all the rows of data for a Text with ID 65 rev 1.
SELECT TextLines.* FROM TextLines
LEFT JOIN Text ON Text.TextLinesID = TextLines.ID AND Text.TextLinesRev = TextLines.Rev
WHERE Text.ID = 65 AND Text.Revision = 1
ORDER BY TextLines.Sequence
I've successfully taken the above query and turned it into a named query, and was wondering, if there isn't a good way to map this relationship using the typical means, if I can take that query I made and use it by join fetching, such as seen in
16.4
Thanks for any help.