My issue is related around the Project-User relationship(s). When I map my Project I have 2 this:
References<User>(x => x.owner).Column("owner_id").ForeignKey();This works a treat when adding and retrieving data to and from the database. I get 2 columns on the Project table that related to the correct instances of User.
However this is where it gets a little weird. When I delete a User, NHibernate will first select any Projects that have the user_id of the User.Id being deleted, update them to NULL and then delete the User. That's fine. But when I delete a User whose ID is stored in the owner_id column NHibernate doesn't seem to recognise that that column value need to be NULL'd before the User is removed. This causes a FK Ref exception.
Is there something I am missing from my mapping or organisation of data? Or is this simply a bug or just not possible?
Thanks,
Greg