I am working on converting an old app written in powerbuilder to a .NET app. In this process we work with an old database, and some of the queries used in the powerbuilder app is quite challenging to convert into nhibernate fluent mapping (for me at least).
I have the following sql to get a list of bits:
SELECT MYSCHEME.BIT.BIT_S,
MYSCHEME.BIT.BIT_NAME,
MYSCHEME.BIT.BIT_TYPE,
MYSCHEME.BIT.BIT_SIZE,
MYSCHEME.BS.BS_NAME,
MYSCHEME.CMS.WHOLE_S
FROM MYSCHEME.BIT join MYSCHEME.BS on ( MYSCHEME.BIT.BS_S = MYSCHEME.BS.BS_S )
left outer join MYSCHEME.OF on MYSCHEME.BIT.BIT_TYPE_S = MYSCHEME.OF.F_S
left outer join MYSCHEME.CMS on MYSCHEME.OF.OF_S = MYSCHEME.CMS.PART_S
WHERE ( MYSCHEME.BS.BS_S = 25)
How should i map this into nhibernate? Should i use criteria and joins, or just map it with references to other tables? An other challenge is that there are very few key constrains in the database, for example there is no key constraint between BIT and OF, or CMS and OF.
Anyone has a good idea of how to solve this challenge? I must also be able to update CMS.WHOLE_S.
The first join to the BS table is not very important, since it is only to get the “parent” information, i can access that information from other parts in my application.
oder