title: Entity manager get or create
body: <p>How can I make sure if the object already exist its not created again.</p>
  
  <pre><code>@Component
  public class ProductServiceImpl implements ProductService
  {
      @PersistenceContext
      private EntityManager em;
  
      public Product getOrCreateProduct(String productName, String peoductDescr)
      {
          Product product =(new Product (productName, peoductDescr));
          em.merge(product);
          return product;
      }
  }
  </code></pre>
  
  <p>I did this way but as it is still keep creating new db entries instead of returning the new one.</p>