I've got a one-many relation :

Object ReportCategory :

Table("RCA_REPORT_CATEGORY");
    Id(r => r.Id, "RCA_ID");
    Map(r => r.Name, "RCA_NAME");
    HasMany<Report>(r => r.Reports)
        .Table("REP_REPORT")
        .KeyColumns.Add("REP_RCA_ID").Cascade.None();

Object Report:

Table("REP_REPORT");
        Id(r => r.Id, "REP_ID");
        Map(r => r.Name, "REP_NAME");
        References(r => r.Category, "REP_RCA_ID")
            .Cascade.None();

There's an overseas key on Repetition_REPORT.Repetition_RCA_ID wich references RCA_REPORT_CATEGORY.RCA_ID.

After i remove a ReportCategory wich includes a Report, it really works and also the Repetition_RCA_ID column within the Report Table is placed to NULL. But i'm not going that. I would like the best to become tossed and let me know the category can not be erased since it is utilized by a study also it violate the foreign key constraint. How do i make that happen ?

Thanks

Make Category reference not nullable:

Table("REP_REPORT");
        Id(r => r.Id, "REP_ID");
        Map(r => r.Name, "REP_NAME");
        References(r => r.Category, "REP_RCA_ID")
            .Not.Nullable()
            .Cascade.None();

Then your database column Repetition_RCA_ID can't be NULL and try to remove not-empty category will result in SQL exception. Such situation ought to be prevented inside your domain model first and also the exception from db ought to be throwed only if there's a bug inside your application.

Perhaps you should mark HasMany collection as inverse to prevent some troubles:

Table("RCA_REPORT_CATEGORY");
    Id(r => r.Id, "RCA_ID");
    Map(r => r.Name, "RCA_NAME");
    HasMany<Report>(r => r.Reports)
        .Table("REP_REPORT")
        .Inverse()
        .KeyColumns.Add("REP_RCA_ID").Cascade.None();