title: Will calling merge method on a managed entity without changes update underlying database?
body: <pre><code>// pm is a product manager object which handles actual database calls
  Product product = pm.findProduct( 1 );
  List&lt;Product&gt; products = pm.findAllProducts();
  products.stream().forEach( System.out::println );
  
  pm.update( product ); // pm object delegates by calling merge on an entity manager object
  products = pm.findAllProducts();
  products.stream().forEach( System.out::println );
  </code></pre>
  
  <p>Both <code>println</code> statements print same number of records, without any change. As there is no state change in <code>product</code> managed entity,</p>
  
  <ol>
  <li>Will persistence provider(PP) still send it to the database for update? State for both cases: when second-level cache is and is not used.</li>
  <li>If no, how does PP determine changes?</li>
  <li>If yes, as there's no difference in second output, how do I know for sure that database updated the record? IOW, how can I determine that database had executed an update statement?</li>
  </ol>
  
  <p>EDIT: Added 'derby' tag.</p>