title: How to set relationship between tables Ebean/Play framework
body: <p>I'm new to Ebean's world, and I encounter some difficulties to set some relationships between entities.</p>
  
  <p>I have basically two classes, <code>User</code> and <code>Car</code>.</p>
  
  <p>A user can have <em>several</em> cars (so I guess <code>OneToMany</code>) and a car can belongs to <em>one</em> User (so I guess <code>OneToOne</code>).</p>
  
  <p>How can I link these two entities? Here it is what I've done so far</p>
  
  <p><strong>User</strong></p>
  
  <pre><code>@Entity
  public class User extends Model{
      @Id
      @GeneratedValue
      public int id;  
      public String name; 
      @ManyToMany(cascade=CascadeType.ALL)
      public List&lt;Car&gt; car = new ArrayList&lt;Car&gt;();
  }
  </code></pre>
  
  <p><strong>Car</strong> </p>
  
  <pre><code>@Entity
  public class Car extends Model{
      @Id
      @GeneratedValue
      public int id;
      @OneToOne(cascade = CascadeType.ALL)
      public User user; 
  }
  </code></pre>
  
  <p>And I get the following error</p>
  
  <blockquote>
    <p>PersistenceException: Error on models.User.car Can not find mappedBy
    property [users] in [models.Car]</p>
  </blockquote>
  
  <p>Can someone explain me clearly how to use annotations the correct way (very poor documentation), and tell me why I get this error?</p>