title: CRUD operations template in java
body: <p>I'm designing a system where I must perform several CRUD operations among the System entities. Just for make sure I searched in forums to see how it's resolved by someone else.</p>
  
  <p>I found 4 <em>"patterns"</em>. All of them agree in the READ operations so I skip them. I'll define the patterns:</p>
  
  <h3>Pattern 1</h3>
  
  <pre><code>void add(E entity);
  void update(E entity);
  // Read operations...
  void delete(E entity);
  </code></pre>
  
  <h3>Pattern 2</h3>
  
  <pre><code>E create(&lt;ListOfEntityProperties&gt;);
  void update(E entity);
  // Read operations...
  void delete(E entity);
  </code></pre>
  
  <h3>Pattern 3</h3>
  
  <pre><code>boolean add(E entity);
  boolean update(E entity);
  // Read operations...
  boolean delete(E entity);
  </code></pre>
  
  <h3>Pattern 4</h3>
  
  <pre><code>E add(E entity);
  void update(E entity);
  // Read operations...
  void delete(E entity);
  </code></pre>
  
  <p>I don't understand the difference and advantages/disadvantages of each one (and no one explains it). What are the differences between each <em>"pattern"</em>? What criteria to use? Can someone justify when to use one way or another (or give me another idea)?</p>
  
  <p>Thanks in advance for your answers</p>