>is it possible that you have team members on a team who don't have the same branch ID?
No. >perhaps your method 2 is actually applying a cascade delete It's not. On Thursday, August 22, 2013 10:30:10 AM UTC-4, Patrick Doran wrote: > > Ok, that makes sense, however is it possible that you have team members on > a team who don't have the same branch ID? I ask this because perhaps your > method 2 is actually applying a cascade delete (could be configured further > up than the mappings you show) on the team members when you go to delete a > team, however your first method, doesn't take that situation in to account. > > IE: > DELETE FROM Employee E where e.team_id in (select team_id from team where > team.branch_id=1) > DELETE FROM Team T where t.branch_id=1 > > This would ensure no FK constraint issues based on the case I mentioned. > > > On Thursday, August 22, 2013 10:07:49 AM UTC-4, [email protected] wrote: >> >> We have the branch_id because sometimes we insert employees without a >> team. >> >> >> On Wednesday, August 21, 2013 8:14:05 PM UTC-4, Patrick Doran wrote: >>> >>> nHibernate aside, your delete command implies that a team may only have >>> employees from the same branch, however your schema doesn't imply that. If >>> your schema didn't have branch_id on the employee then you could delete all >>> employees on a team, all teams from a branch etc. I am sure you are >>> enforcing that part with business logic, but just something I noticed. >>> >>> On Wednesday, August 21, 2013 5:31:50 PM UTC-4, [email protected] wrote: >>>> >>>> We call ExecuteUpdate(). I forgot to put it in the post. >>>> >>> -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/groups/opt_out.
