My data structure:

Project {
*    int* id,
*    User* user,
*    User* owner,
    List<*Notes*> notes
}

User {
*    int* id, 
    *string* name
}

My issue is related around the Project-User relationship(s). When I map my 
Project I have 2 this:

References<User>(x => x.user).Column("user_id").ForeignKey();

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

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/fluent-nhibernate/-/t8BHlqf-DMkJ.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to