title: Determine if entity is new without checking @Id
body: <p>Is there a way to determine given for example entity class: </p>
  
  <pre><code>@Entity
  class A {
  
      String name;
  
  }
  
  boolean method(Object anyEntity) {
       // How can I check here, if this entity is completely new    
  }
  </code></pre>
  
  <p>By new, I mean someone invoked new A() and possibly even set the name, but was never saved, or persisted. </p>
  
  <p>Normally one could check the id, but I want a solution that doest not requires an id, or a getId() method. </p>
  
  <p>Basically, has this entity been persisted to the database, even in detached mode. </p>
  
  <p>@Version or getVersion is also not a satisfactory solution.</p>
  
  <p>Maybe isDetached || isAttached might work, but I am not sure how to make that call on Hibernates API.</p>
  
  <p>EDIT:</p>
  
  <p>Also clarify, I do not control the entities, so I can not add any fields to them. Solution should try to make use of underlying mechanisms to determine this. </p>