title: Batch update returned unexpected row count from update; actual row count: 0; expected: 1
body: <p>I'm having difficulty to figure out NH exception:</p>
  
  <blockquote>
    <p>Batch update returned unexpected row count from update; actual row
    count: 0; expected: 1</p>
  </blockquote>
  
  <p>My Dal code:</p>
  
  <pre><code> public T Save(T item)
          {
              using (ISession session = NHibernateHelper.GetSession())
              {
                  using (var transaction = session.BeginTransaction())
                  {
                      session.SaveOrUpdate(item);
  
                      transaction.Commit();
  
                      return item;
                  }
              }
          }
  </code></pre>
  
  <p>My log4net file:</p>
  
  <blockquote>
    <p>command 0:UPDATE Metadata_FriendDetails SET UserId = @p0, Email = @p1,
    Name = @p2 WHERE FriendId = @p3;@p0 =
    a358ab9d-d481-4bdd-8cb2-18ddc8898c70 [Type: Guid (0)], @p1 =
    '1@hotmail.com' [Type: String (4000)], @p2 = 'myFriend' [Type: String
    (4000)], @p3 = 2ea35658-edb1-43e3-b848-e1915d1042df [Type: Guid (0)]</p>
    
    <p>2011-12-02 13:06:49,750 [Agent: adapter run thread for test
    'SaveFriendDetails_Test' with id
    '17016e48-1ff4-4dea-8536-6aa3b24e5fb7'] DEBUG
    NHibernate.AdoNet.AbstractBatcher - Closed IDbCommand, open
    IDbCommands: 0 2011-12-02 13:06:49,751 [Agent: adapter run thread for
    test 'SaveFriendDetails_Test' with id
    '17016e48-1ff4-4dea-8536-6aa3b24e5fb7'] ERROR
    NHibernate.Event.Default.AbstractFlushingEventListener - Could not
    synchronize database state with session
    NHibernate.StaleStateException: Batch update returned unexpected row
    count from update; actual row count: 0; expected: 1</p>
  </blockquote>
  
  <p>Does anyone see the problem?</p>
  
  <p>TIA</p>