NHibernate, one-to-one mapping, cascade insert -
I have one-to-one relationship between the company class and company settings class. When I create a new company object, (Company settings are created for the objects in the company's comptuctor's settings), and then
SaveOutUpdate (session, company object) I hope INSERT has to cascade in company settings from company.
The mapping files are shown below:
& lt ;? XML version = "1.0" encoding, however, it does not happen unless I explicitly call SaveOrUpdate on the CompanySettings object. = "UTF-8"? & Gt; & Lt; Hibernate-mapping xmlns = "kalash: nurbinet-mapping2.2" `& gt; & Lt; Class name = "AST.Domain.Company, AST.Domain" table = "companies" & gt; & Lt; Id name = "EntityID" column = "CompanyId" & gt; & Lt; Generator class = "guid.comb" /> & Lt; / Id & gt; & Lt; Property Name = "Company Name" /> . . . & Lt; One-to-one name = "setting" class = "AST.domain.company settings, AST.Damman" constrain = "true" lazy = "wrong" /> & Lt; / Square & gt; & Lt; / Hibernate-mapping & gt; My mapping file for the company settings class:
& Lt; One-one-one name = "company" class = "a.dom.domain.company, ast.domain" /> & Lt; / Square & gt; & Lt; / Hibernate-mapping & gt;
Did you specify cascade = "all" Have tried your mapping?
Comments
Post a Comment