title: How to make one-to-one mapping playframework
body: <p>I'm trying to set a one-to-one mapping between two tables by using playframework.I would like to create rating list for each user after this mapping. However, I couldn't. Could you help me?
  My two seperate classes are like that:</p>
  
  <p><code>User.java</code></p>
  
  <pre class="lang-java prettyprint-override"><code>package models;
  
  import java.util.*;
  
  import javax.persistence.*;
  
  import play.db.jpa.Model;
  
  @Entity
  @Table(name = "`user`")
  public class User extends Model {
      public String name;
      public String surname;
      public String password;
      public String username;
      public Date lastlogin;
  
  
      @Id
      @GeneratedValue 
  }
  </code></pre>
  
  <p><code>UserRating.java</code></p>
  
  <pre class="lang-java prettyprint-override"><code>package models;
  
  import java.util.*;
  
  import javax.persistence.*;
  
  import play.db.jpa.Model;
  
  @Entity
  @Table(name = "`userrating`")
  public class UserRating extends Model {
      public double rating;    
  
  
      @Id
      @GeneratedValue
      @MapsId
  
  
      @OneToOne()
      @JoinColumn(name="user_id")
      public User user;
  }
  </code></pre>
  
  <p>My yaml file is that:</p>
  
  <pre><code>User(19):
      name: freud
      surname: lily
      password: x56
      username: freud
      lastlogin: 2010-05-02
  User(20):
      name: osman
      surname: özsu
      password: 798
      username: osman
      lastlogin: 2004-12-11
  
  
  UserRating(1):
      rating: 1.2
      user: User(2)
  </code></pre>