I have a reference to a class that has a composite-id of two columns. I want to make the relationship with one column and one formula.
In hbm I would map it like this:
<many-to-one name="Tapa" update="false" insert="false"> <column name="D_Tapa" /> <formula>0</formula> </many-to-one>
And it works. But when I try to do it in fluent like this:
References(x => x.Tapa) .Column("D_Tapa") .Formula("0") .Not.Insert().Not.Update();
It doesn't recognize the formula and gives the following error:
NHibernate.FKUnmatchingColumnsException: Foreign key (FKEF1FC30E53D4A11E:mySecondTable [D_Tapa])) must have same number of columns as the referenced primary key (dbo.myTable [IdArt, IdColor]) en NHibernate.Mapping.ForeignKey.AlignColumns(Table referencedTable) en NHibernate.Cfg.Configuration.SecondPassCompileForeignKeys(Table table, ISet`1 done)