I like the idea of the optional joined component or property. It
allows me to factor optional properties out from the main table to a
dedicated table thus allowing me to eliminate nullable columns in the
main table. Unfortunately I noticed that though I mapped joined
properties as optional (with <join optional="true"...) NH still
requires that joined properties be mapped as nullable. I don't
consider this to be a correct behavior of NH. IMHO the whole group of
joined properties or components can be optional but constituent
properties can or cannot be nullable. To clarify a picture here is a
few lines of code:

<class name="Organization">
    [...omitted...]
    <join table="card_org_contract" optional="true">
        <key column="org_id" />
        <component name="Contract" class="OrganizationContract">
            <property name="ContractNumber" column="cntr_num" not-
null="true" />
            <property name="ContractDate" column="cntr_date" not-
null="true" />
         </component>
    </join>
</class>

When I try to save the entity like this

session.Save(new Organization { Name = "...", TaxCode = "..." })

NH complains that Contract property is null although I pointed NH that
component OrganizationContract is optional and can be null. When I
make properties of the component as nullable everything works. But I
don't think this is a correct solution.
Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com.
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to