Hello,

I´ve been trying to use cascade delete, but, for some reason, it is
not working ;/
I checked most of the cascade delete topics but nothing seems to work
for me, so, any help is appreciated.

Here´s a prototype of what I have:

[code]
class A {
[PrimaryKey("A_ID")]
public int Id { get; set; }

[HasMany(Inverse=true,
Cascade=ManyRelationCascadeEnum.AllDeleteOrphan)]
public IList<B> BList { get; set; }
}
[/code]

[code]
class B {
[PrimaryKey("B_ID")]
public int Id { get; set; }

[BelongsTo("A_ID")]
public A AId { get; set; }

[HasMany(Inverse=true,
Cascade=ManyRelationCascadeEnum.AllDeleteOrphan)]
        public IList<C> CList { get; set; }
}
[/code]

[code]
class C {
[PrimaryKey("C_ID")]
public int Id { get; set; }

[BelongsTo("B_ID")]
public B BId { get; set; }
}
[/code]


and this is the error I get:
[code]
[OracleException (0x80131938): ORA-02292: integrity constraint
(PROJECTNAME.FK929B9C00F122688D) violated - child record found
]
   System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle
errorHandle, Int32 rc) +166
   System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle
statementHandle, CommandBehavior behavior, Boolean needRowid,
OciRowidDescriptor& rowidDescriptor, ArrayList&
resultParameterOrdinals) +1719
 
System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean
needRowid, OciRowidDescriptor& rowidDescriptor) +503
   System.Data.OracleClient.OracleCommand.ExecuteNonQuery() +140
   NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd)
+261
   NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation
expectation) +49
   NHibernate.Persister.Entity.AbstractEntityPersister.Delete(Object
id, Object version, Int32 j, Object obj, SqlCommandInfo sql,
ISessionImplementor session, Object[] loadedState) +1277

[GenericADOException: could not delete: [A#90][SQL: DELETE FROM A
WHERE A_ID = ?]]
   AA.Delete() in AA:152
   AA.Process() in AA.cs:105
   AList.GridView1_RowDeleting(Object sender, GridViewDeleteEventArgs
e) in AList.aspx.cs:39
 
System.Web.UI.WebControls.GridView.OnRowDeleting(GridViewDeleteEventArgs
e) +133
   System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row,
Int32 rowIndex) +604
   System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +1134
   System.Web.UI.WebControls.GridView.RaisePostBackEvent(String
eventArgument) +199
 
System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+177
   System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1746
[/code]

Can anyone help?

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en.

Reply via email to