Thanks for the reply. Is there a way to circumvent this. In the sense if we have a one-to- many relationship mapped using the table-per-class struct then on deleting one of the subclass the other subclass should not be deleted. This would be on the lines of the way the relational data works.
If we set the cascade property to none then we get the referential error. One of the ways is to handle the error such that the parent record does not get deleted. However this would be a work around and not a solution. Kindly advise. Regards, Anil On Feb 2, 9:40 am, Fabio Maulo <fabioma...@gmail.com> wrote: > The strategy you are talking about is: Table-per-class > For sure when you delete a subclass the delete will happen in the subclass > and in all its superclass because what you are deleting is an object > instance where the state is spanned between more than one table. > > 2010/2/2 Mind Works <ani...@gmail.com> > > > > > Hi, > > > We have modeled the relationship between domain objects using the > > table per subclass hierarchy structure. > > > The structure looks like: > > > Parent: > > > <?xml version="1.0" encoding="iso-8859-1"?> > > <hibernate-mapping default-lazy="false" default-cascade="none" > > xmlns="urn:nhibernate-mapping-2.2" > > > <class name="ParentDO, TestProject1" table="TBLX" dynamic-insert > > ="false" dynamic-update="false"> > > <id name="ID" column="IDCol" type="System.Int64" unsaved-value="null"> > > <generator class="sequence"> > > <param name="sequence">SEQ01T</param> > > </generator> > > </id> > > <version name="ver" column="ROWID" type="Int32" generated="never" > > unsaved-value="null" /> > > <property name="Xid" column="XID" type="System.Int64" > > insert="true" update="true" /> > > <property name="RowID" column="ROWID" type="System.String" > > insert="false" update="false" /> > > </class> > > </hibernate-mapping> > > > The relationship has been mapped as follows: > > > <?xml version="1.0" encoding="iso-8859-1"?> > > <hibernate-mapping default-lazy="false" default-cascade="none" > > xmlns="urn:nhibernate-mapping-2.2"> > > <joined-subclass name="Child, TestProject1" extends="ParentDO, > > TestProject1" table="TBLY" > > > <key column="CHILDID" foreign-key="PARENTID"/> > > <property..../> > > <property..../> > > </joined-subclass> > > </hibernate-mapping> > > > The delete cascade works as desired, however whenever we delete the > > subclass the delete happens not only on the table to which the > > subclass has been mapped, but also the root table and potentially > > joined-subclass tables further down the inheritance hierarchy. > > > We have tried setting the dynamic-update and dynamic-insert properties > > to false and also tried to set the cascade property to save-update, > > none... The delete still moves up to the parent table. > > > Is this a known issue, or are we missing something. > > > Please help. > > > -- > > You received this message because you are subscribed to the Google Groups > > "nhusers" group. > > To post to this group, send email to nhus...@googlegroups.com. > > To unsubscribe from this group, send email to > > nhusers+unsubscr...@googlegroups.com<nhusers%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. > > -- > Fabio Maulo -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhus...@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.