title: NHibernate save non-persisted entity while maintaining the existing ID
body: <p>It's not a really common case, but in this particular one the task is to accomplished this :</p>
  
  <ol>
  <li>Serialize a list of existing entities loaded with NHibernate in database A</li>
  <li>Export the serialized entities to a file</li>
  <li>Import the serialized entities file to database B, using NHibernate as the persisting agent</li>
  </ol>
  
  <p>The problem is the entities maps is marked with Id generator : </p>
  
  <pre><code>public class EntityMap
  {
      public EntityMap()
      {
          Id(x =&gt; x.Id)
              .GeneratedBy.Guid();
          // Other properties
      }
  }
  </code></pre>
  
  <p>With that mapping, everytime I called :</p>
  
  <pre><code>ISession session = NHibernateSession.GetSession();
  IList&lt;Entity&gt; entities = // Load entity from serialized object in a file
  
  foreach(entity in entities)
  {
      session.Save(entity);
  }
  </code></pre>
  
  <p>NHibernate keeps generating a new Id for those entities.</p>
  
  <p>Is there a way to keep the mapping having Id generation strategy, but somehow able to persist an existing entity with it's Id predefined?</p>