deleted object would be re-saved by cascade (remove deleted object from associations) hibernate

Posted by Kasani007 under C# on 11/25/2015 | Points: 10 | Views : 1504 | Status : [Member] | Replies : 1
I am using C# with NHibernate ORM,
When I Am Trying To Delete An Object Data, It is Showing Exception

"ObjectDeletedException was caught
deleted object would be re-saved by cascade (remove deleted object from associations)
[Application.Domain.ContactAddress#327] "

How can I Rectify It...Help Me...

The Code Is Below That I Had Used To Delete
public void Delete(TEntity t)
{
using (var tx = Session.BeginTransaction())
{
try
{
Session.Delete(t);

tx.Commit();
}
catch (Exception ex)
{
tx.Rollback();
}
}
}




Responses

Posted by: Rajnilari2015 on: 11/25/2015 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
Set the inverse="true" property on the correct side of the relationship.

http://stackoverflow.com/questions/302720/how-to-delete-child-object-in-nhibernate

Hope that helps

--
Thanks & Regards,
RNA Team

Kasani007, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response