I have a few objects.
Project Object - this represents a basic project
ProjectDependency Object - this is mapping object that maps one project to another project (the dependent project). See the nhibernate relationships:
here is the ProjectDependencies mapping class:
public class ProjectDependencyMap
{
public ProjectDependencyMap()
{
References(x => x.Project).Not.Nullable().Fetch.Join();
References(x =>.DependencyProject).Not.Nullable().Column("DependencyProjectId").Fetch.Join();
}
}
and here is the project map file:
public class ProjectMap
{
public ProjectMap()
{
HasMany(x => x.ProjectDependencies).AsBag().Inverse().Cascade.AllDeleteOrphan().Fetch.Select().BatchSize(80);
HasMany(x => x.ProjectDependentOf).KeyColumn("DependentProjectId").AsBag().Inverse().Cascade.AllDeleteOrphan().Fetch.Select().BatchSize(80);
}
}
normally this works fine but sometimes when i go to delete a project using:
var project = Model.GetProject(id);
Repository.Delete(project);
Repository.Commit()
I get this error:
deleted object would be re-saved by cascade (remove deleted object from associations)[ProjectDependency#324]
Can someone help clarify what the issue is here and if the way i am using the mapping above is incorrect