title: How to tell what action was taken by the JPA save method
body: <p>I have a repo:</p>
  
  <pre><code>public interface SomeRepository extends CrudRepository&lt;SomeClass, Long&gt; {
      SomeClass findById(Long id);
  }
  </code></pre>
  
  <p>and I need to save objects to it:</p>
  
  <pre><code>SomeClass someClass = GetAMaybeNewSomeClass();
  someClass = someRepository.save(someClass);
  </code></pre>
  
  <p>how do I tell, in code, what operation the save call did? I need to know if someClass already existed in the database, and if it did exist, I need to know if the call to save actually changed it.</p>
  
  <p>I could do this by calling findById before the save operation and comparing what I find with what I'm saving, but I'd rather use something built in to the framework if it exists.</p>