I am using 2.1.0. Upon looking at this further using session.Delete(post) works like a charm, but if you do a batch operation like session.ExecuteUpdate (delete from PostEntity) it does not.
On Dec 28, 7:33 am, Fernando Zago <[email protected]> wrote: > I don't think so, > > i'm doing a test and works like a charm delete the root entity, delete the > child entity when its cascada=all > > whats your nh version ? > --- > Vision without action is a waking dream. > Action without vision is a nightmare. > > On Wed, Dec 23, 2009 at 3:11 PM, Diego Mijelshon > <[email protected]>wrote: > > > A many-to-one relationship will never delete; you're on the wrong side. > > Youy might be looking for one-to-one (Section 5.1.11) > > > Diego > > > On Wed, Dec 23, 2009 at 13:55, Joe <[email protected]> wrote: > > >> I am having trouble getting a many-to-one association to delete the > >> associated entity when the main entity is deleted. > > >> For example, a post has a many-to-one mapping to content. When a post > >> is deleted I want the content to be deleted as well. Saves work fine, > >> just cannot get the delete to work. > > >> Here are the mappings: > >> For the post: > >> <class name="PostEntity" table="YABE_Post"> > >> <id name="Id"> > >> <generator class="guid.comb" /> > >> </id> > >> <property name="Title" not-null="true" length="50" > >> access="field.camelcase" /> > >> <property name="Url" length="50" /> > >> <property name="DatePublished" /> > >> <property name="DateCreated" not-null="true" /> > >> <property name="MonthPublished" /> > >> <property name="YearPublished" /> > >> <many-to-one name="Author" column="AuthorId" /> > >> <many-to-one name="Content" cascade="all" column="ContentId" /> > >> <many-to-one name="Blog" column="BlogId" /> > >> <many-to-one name="Category" column="CategoryId" cascade="save- > >> update" /> > >> <set name="Comments" access="field.camelcase" inverse="true" > >> cascade="all-delete-orphan"> > >> <key column="PostId" /> > >> <one-to-many class="CommentEntity" /> > >> </set> > >> <set name="postTags" access="field.camelcase" cascade="all-delete- > >> orphan" inverse="true"> > >> <key column="PostId" /> > >> <one-to-many class="PostTagEntity" /> > >> </set> > >> </class> > > >> and the content: > >> <class name="PostContentEntity" table="YABE_PostContent"> > >> <id name="Id" column="Id"> > >> <generator class="guid.comb" /> > >> </id> > >> <property name="Text" /> > >> </class> > > >> Any idea what I am doing wrong? > > >> Thanks, > >> Joe > > >> -- > > >> You received this message because you are subscribed to the Google Groups > >> "nhusers" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<nhusers%[email protected]> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/nhusers?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "nhusers" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<nhusers%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
