title: JPA - use class as an entity and embeddable at once?
body: <p>I'm JPA newbie and I have probably stupid question ;)</p>
  
  <p>Let <code>Node</code> be a class representing some blog post.</p>
  
  <pre class="lang-java prettyprint-override"><code>@Entity
  @Table(name="nodes")
  public class Node {
      @Id
      @GeneratedValue
      private long id;
      private String title;
      private String body;
  }
  </code></pre>
  
  <p>I want to make an archive of deleted nodes in separate table (I don't want to mess <code>nodes</code> table with removed nodes using <code>deleted</code> flag). Archive entry should have additional fields: <code>DateTime deletedAt</code>, <code>String deletedBy</code> and maybe something else.</p>
  
  <p>Is there any possibility to make a class <code>ArchivedNode</code> in the following way:</p>
  
  <pre class="lang-java prettyprint-override"><code>@Table(name="archived_nodes")
  @Entity
  public class ArchivedNode {
      private DateTime deletedAt;
      private String deletedBy;
      // ...
      @Embedded
      private Node node;
  }
  </code></pre>
  
  <p>? Or maybe there is a better solution for archiving entities in separate tables?</p>