title: NHibernate many-to-one relationship
body: <p>We have the following Domain objects :-</p>
  
  <pre><code>public class UserDevice : BaseObject
  {
  // different properties to hold data
  }
  
  public class DeviceRecipient:BaseObject
  {
   public virtual UserDevice LastAttemptedDevice{get;set;}
  }
  </code></pre>
  
  <p>Hence the sql schema created based on this using fluent nhibernate automapper is like
  DeviceRecipient's table is having primary key of UserDevice as a foreign key i.e UserDevice_Id.</p>
  
  <p>Now, When we try to delete UserDevice object it gives a sql exception for foreign key constraint. What we want to do is :-</p>
  
  <ol>
  <li>Delete the UserDevice object , hence the UserDevice row without deleting the DeviceRecipient as it will be used somewhere else in domain model. We just want to set null to UserDevice_Id column of DeviceRecipient when we delete UserDevice.</li>
  <li>We want to do it using fluent nhibernate conventions as we use Automapping. </li>
  </ol>
  
  <p>Any help will be appreciable.. Thanks in advance.!</p>