title: How do I add additional criteria to my update command using NHibernate?
body: <p>I have situation where a Message table has a primary key (Id) and a foreign key (Site).  Any site can create a message record, but only the site that created the record can update it.  The problem is that by default it will be updated based upon Id and not Id and Site.  I could change the primary key to be a composite/compound id consisting of the id and site OR resort to Native SQL; however, I was wondering if there is a way to add additional Update criteria.</p>
  
  <p>For example, this is what you get by default:</p>
  
  <pre>
  public void MessageUpdate(Message oneMessage)
  {
      using(ISession session = SessionFactory.OpenSession())
      using(ITransaction trans = session.BeginTransaction())
      {
          session.Update(oneMessage);
          trans.Commit();
      }
  }
  
  </pre>
  
  <p>So how do I do this in NHibernate without creating a compound id or using Native SQL:</p>
  
  <pre>
  Update MessageTable set MessageStatus = 2 where Id = ? and Site = ?;
  </pre>