title: Why does not delete method of spring data (JPA) have any return values?
body: <p>I have used a delete method of <code>Spring Data JPA</code> in the service layer, but I wonder why neither the <code>deleteById</code> method nor <code>delete</code> method has any return values.</p>
  
  <p>If we inspect the implementation of the delete method carefully, there is an <strong><em>if statement</em></strong> that when the entity to be deleted doesn't exist returns nothing.</p>
  
  <pre><code>public void delete(T entity) {
  
      Assert.notNull(entity, "Entity must not be null!");
  
      if (entityInformation.isNew(entity)) {
          return;
      }
  
      Class&lt;?&gt; type = ProxyUtils.getUserClass(entity);
  
      T existing = (T) em.find(type, entityInformation.getId(entity));
  
      // if the entity to be deleted doesn't exist, delete is a NOOP
      if (existing == null) {
          return;
      }
  
      em.remove(em.contains(entity) ? entity : em.merge(entity));
  }
  </code></pre>
  
  <p>Personally, I think returning a <code>Boolean</code> value could be an adequate approach in this case because the controller layer will know about the deletion status, and the view layer can be provided with the far more reliable alert message.</p>