title: How to prevent NHibernate from creating duplicate records for referenced objects
body: <p>I'm having trouble with saving an object into my database using NHibernate.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>Image image = new Image { Url = 'test.jpg' };
  Product product1 = new Product { Name = 'MyProduct', Image = image };
  Product product2 = new Product { Name = 'MyProduct2', Image = image };
  
  MySession.Save(product1); // This also creates an Image record
  MySession.Save(product2); // This creates another Image record even tho the data is exactly the same
  </code></pre>
  
  <p>I would like to prevent the image from being created twice.
  Is there a standard NHibernate solution for that or do i have to create a custom Save() method for the Product class?</p>