Ups sorry... I was looking wrong classes; you sent 3 classes not two. The mapping between Article and ArticleExtension is correct.
On Fri, Sep 23, 2011 at 2:03 PM, Fabio Maulo <[email protected]> wrote: > Wrong mapping. > You are trying to implement a *bidirectional one-to-one (foreign key > association)* but the mapping-pattern is not corrected implemented. > > After raise the question to the nhusers group and implement the correct > mapping-pattern you can come back with the issue if it is already there. > > On Fri, Sep 23, 2011 at 1:52 PM, Stuart Carnie <[email protected]>wrote: > >> What follows is the mapping, and it is bi-directional. Article is the >> parent and ArticleExtension is the 1:1 relationship, with foreign as the key >> property generation policy (i.e. it takes Article's Id). >> >> <?xml version="1.0" encoding="utf-8" ?> >> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" >> assembly="NHibernate.Test" >> namespace="NHibernate.Test.Criteria.FetchAllProperties" >> default-access="property" >> default-lazy="true"> >> >> <class name="Article" table="Article"> >> <id name="Id" type="Int64"> >> <generator class="native"/> >> </id> >> <property name="Title" /> >> <property name="Description" lazy="false"/> >> <set name="Comments" inverse="true" cascade="all-delete-orphan"> >> <key column="article_id"/> >> <one-to-many class="Comment"/> >> </set> >> >> <one-to-one name="ArticleExtension" class="ArticleExtension" >> cascade="all" lazy="no-proxy" /> >> </class> >> >> <class name="ArticleExtension" table="ArticleExtension"> >> <id name="Id" type="Int64"> >> <generator class="foreign"> >> <param name="property">Article</param> >> </generator> >> </id> >> >> <property name="Rating" /> >> <property name="Notes" lazy="true" /> >> >> <one-to-one name="Article" class="Article" constrained="true" /> >> </class> >> >> <class name="Comment" table="Comment"> >> <id name="Id" type="Int64"> >> <generator class="native" /> >> </id> >> <property name="Subject" /> >> <property name="Text" lazy="true"/> >> <many-to-one name="Article" column="article_id"/> >> </class> >> >> </hibernate-mapping> >> >> > > > -- > Fabio Maulo > > -- Fabio Maulo
