I can't find anything in the nhibernate documentation that indicates
how you would do this with the xml. You might be best served asking on
the nhusers list to determine the necessary xml so that we can then
help you map it with FNH.

On Wed, Jan 6, 2010 at 11:25 PM, Olga <olgaru...@gmail.com> wrote:
> Hello,
>
> I have two tables that I want to map to one class that will looks
> like:
>
> CUSTOMER_INFO_CLASS.cs
> ----------------------
> Id (CUSTOMER table)
> CustomerName (CUSTOMER table)
> CustomerTypeDesc (CUSTOMER_TYPE table)
> I tried to do it with join, as follows:
>
> Table("CUSTOMER");
>
> Id(x => x.ID).Length(10).Column("CustomerId");
> Map(x => x.CustomerName);
>
> Join("CUSTOMER_TYPE", m =>
>    {
>    m.Optional();
>    m.Map(x => x.CustomerTypeDesc);
>    m.KeyColumn("CustomerType");
>    });
> The problem is that the field with whom I'm trying to link the two
> tables is not a primary key in any of them. (And by default the join
> done by the field that defined as ID) So I found that for the
> CUSTOMER_TYPE table I can define the field by “KeyColumn”.
> How can I define that the related column in the CUSTOMER table will be
> CustomerTypeCode and not CustomerId? (if I can at all)
>
> At the end the sql query should looks like:
>
> Select Id, CustomerName, CustomerAddress, CustomerTypeDesc
> From CUSTOMER t1
>  Left join CUSTOMER_TYPE t2
>    On t1.CustomerTypeCode = t2.CustomerType
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Fluent NHibernate" group.
> To post to this group, send email to fluent-nhibern...@googlegroups.com.
> To unsubscribe from this group, send email to 
> fluent-nhibernate+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibern...@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.


Reply via email to