I’m trying to map a component of type: FormFieldType to a property on type: FormField.
I have two tables in db: FormField and FormFieldType.
mapper.Class<FormField>(map=>map.Component<FormFieldType>(p=>p.FormFieldType,
cm=>
{
cm.Property(x => x.FormFieldTypeName, m => m.Column("FORM_FIELD_TYPE_NAME"));
cm.Property(x => x.FieldType, m => m.Column("FIELD_TYPE"));
cm.Property(x => x.Regex, m => m.Column("REGEX"));
}));
When I try to query the FormField table it says that columns: FORM_FIELD_TYPE_NAME, FIELD_TYPE, REGEX
does not exist.
It is because nhibernate thinks that they are part of FormField table. But they are in FormFieldType table.
How to correctly map this?
Please help.
Per my answer on the nhusers board. you want to be using a ManyToOne against 2 entities and not map this as a component. A component is used to map multiple domain objects to a single table.