Hello, I'm having a problem mapping a column in table A to a property of a class, which is primarily mapped to table B. The following explains this better:
There's a class CustomerRisk, which has properties Risk and CustomerNumber.
In the database, this consists of two tables: Customer, which has a column CustomerNumber, and CustomerRisk, which has a Foreign Key to Customer, and one to Risk.
Mapping the Risk isn't hard, but mapping the CustomerNumber is the problem. Is it possible to do this without creating a Customer class*? So that NHibernate joins to the Customer class to select the CustomerNumber:
select cn.CustomerNumber, r.Description
from CustomerRisk cr
inner join Customer c on c.CustomerID = cr.CustomerID
inner join Risk r on r.RiskID = cr.RiskID
Multiple CustomerRisk records can have the same CustomerID of course.
Hoping this is a little clear, thank a lot.
- I know you'd normally need a customer class, but I've 'anonymized' the classes.