title: JPA entity to SQL
body: <p>mI've this entity class:</p>
  
  <pre><code>@Entity  
  public class User implements Serializable {
  
      @Id
      @GeneratedValue(strategy=GenerationType.AUTO)
      private Long id;
      @ManyToOne
      private User myFriend;
      @OneToMany(mappedBy="friend")
      private Collection&lt;User&gt; friends;
  
      // Getters, Setters, serialVersionUID, etc... }
  }
  </code></pre>
  
  <p>and this snippet to populate database (reference: <a href="https://stackoverflow.com/questions/3393515/jpa-how-to-have-one-to-many-relation-of-the-same-entity-type">JPA: How to have one-to-many relation of the same Entity type</a>)</p>
  
  <pre><code>public static void main(String[] args) {
  
      EntityManager em = ... // from EntityManagerFactory, injection, etc.
  
      em.getTransaction().begin();
  
      User a   = new User();
      User b   = new User();
      User c   = new User();
  
      b.setMyfriend(a);
      c.setMyfriend(a);
      a.setFriends(Arrays.asList(a, b));
  
      em.persist(a);
      em.persist(b);
      em.persist(c);
  
      em.getTransaction().commit();
  }
  </code></pre>
  
  <p>But I've problem with SQL source. Can I create a SQL source from this entity class?</p>