title: JPA model relations
body: <p>I am currently programming a board for me and my friends with the playframework 1.2.4 that uses the JPA.
  Everything was fine until I came to the view mechanism.</p>
  
  <p>The problem is, that every user can have multiple view entries.
  Every topic can also have multiple view entries so here is my view model:</p>
  
  <pre><code>@Entity
  public class ForumTopicView extends Model
  {
  
      @Required
      @ManyToOne
      public ForumTopic   topic;
  
      @Required
      @ManyToOne
      public User         user;
  
      @Required
      public Date         viewDate;
  
  }
  </code></pre>
  
  <p>On the other hand, there is only one view for a topic AND the connected user.</p>
  
  <p>Here is my topic model:</p>
  
  <pre><code>@Entity
  public class ForumTopic extends Model
  {
  
      // ...
  
      @OneToOne(mappedBy = "topic") // TODO: and the connected user
      public ForumTopicView       view;
  
      // ...
  }
  </code></pre>
  
  <p>How can I customize this that the user has to be the connected user and for every topic only one view selected is.</p>
  
  <p>Thanks for any help!!
  MRu</p>
  
  <p>@Yogendra Singh: Yes thats correct. Every user can have a view to one topic.</p>