title: Play framework 2.0 - Ebean @OneToOne "user - details"
body: <p>I need some help please.
  I have two classes <strong>user</strong> and <strong>details</strong> on a @OneToOne relationship</p>
  
  <pre><code>public class User extends Model {
  
  @Id
      public Long id;
  
      @Constraints.Required
      @Formats.NonEmpty
      public String username;
  
      @OneToOne(mappedBy="user", cascade=CascadeType.ALL)
      public OwnerDetail ownerDetails;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class OwnerDetail extends Model {
      @OneToOne
      @JoinColumn(name = "user_id", nullable = false)
      public User user;
  
      public String fname;
      public String lname;
  </code></pre>
  
  <p>What query am I supposed to run in the User model in order to get the details and in the html/template file to be able to use: <code>@user.ownerDetails.fname</code> or am I approaching this the wrong way?</p>
  
  <p>The query that I am currently running is below, and in the console I see the correct sql generated but I still cannot do <code>@user.ownerDetails.fname</code>.</p>
  
  <pre><code>public static User findByUsername(String email) {
      User user = find.fetch("ownerDetails").​where()
          .eq("username", email)
          .findUnique();
  }
  </code></pre>