How to map a Component in Mapping by convention NH3.3

23 views
Skip to first unread message

Luka

unread,
Apr 16, 2012, 8:06:21 AM4/16/12
to nhu...@googlegroups.com
Hi, 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.

Fran Knebels

unread,
Apr 16, 2012, 8:57:35 AM4/16/12
to nhu...@googlegroups.com
I don't think you are using Component correctly in this case.

See this link here:


The classic case for component in when 2 domain types live in the same table.  

It looks like what you want is a ManyToOne mapping 


--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/h3rp-C44bTIJ.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.

Luka

unread,
Apr 16, 2012, 9:06:01 AM4/16/12
to nhu...@googlegroups.com
I see, thanks

To unsubscribe from this group, send email to nhusers+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages