title: How do I insert collection of objects using MyBatis 3.x?
body: <p>I'm a beginner with MyBatis.</p>
  
  <p>I just want to know how to insert a collection of objects from an instance of a class. Say I have a class User related to a Note in one-to-many relationship. I just like to mention that I built my schema using JPA 2 annotations via Hibernate's hbm2ddl. I'll add the key JPA annotations I used in the sample code below.</p>
  
  <p>Here's a sample:</p>
  
  <pre><code>@Entity
  public class User {
      ...
      @OneToMany
      @JoinColumn(name="user")
      public List&lt;Note&gt; getNotes() {...}
      ...
  }
  </code></pre>
  
  <p>Now, everytime I insert something into User table I have to insert instances into the Note table if the list is not empty. Take note of the @JoinColumn in Note table which should have the id of the inserted User, which I have set to be autogenerated.</p>
  
  <p>Has anyone got something like this working? Thanks.</p>