title: Foreign key constraint using ebean in play
body: <p>Tables:</p>
  
  <ol>
  <li><code>Attributes</code>: Movie attributes (drama, thriller etc) (has columns: id, name)</li>
  <li><code>User</code>: User in the system (has columns: id, name)</li>
  <li><code>Movie</code>: Has attributes associated (like 'matrix' having 'sci-fi - 60%', 'thriller - 40%' etc) (has columns: id, attrid, fraction) - <code>attrid</code> is a foreign key into <code>Attributes</code></li>
  <li><code>Preference</code>: User's preference for a movie (has columns: id, uid, movieid, rating) - <code>uid</code> is foreign key into <code>User</code> and <code>movieid</code> is foreign key into <code>Movie</code>.</li>
  </ol>
  
  <p>This is the model description I have so far:</p>
  
  <pre><code>  User:
  
    @Entity
    @Table(name="USER")
    public class User extends Model {
      @Id
      @Column(name = "uid")
      public Long uid;
  
      @Column(name = "name")
      public String name;
    }
  
    Movie Attribute:
  
    @Entity
    @Table(name = "MOVIEATTRIBUTE")
    public class Attribute extends Model {
      @Id
      @Column(name = "attrid")
      public Long attrid;
  
      @Column(name = "name")
      public String name;
  
      @ManyToMany
      @JoinColumn(name = "movieid")
      public Movie movie;
    }
  
    Movie:
  
    @Entity
    public class Movie extends Model {
      @Id
      @Column(name = "movieid")
      public Long movieid;
  
      @ManyToMany
      @JoinColumn(name = "attrid")
      public Attribute attribute;
  
      @Column(name = "rating")
      public Integer rating;
    }
  
    Preference:
  
    @Entity
    public class Preference extends Model {
      @Id
      @Column(name = "prefid")
      public Long prefid;
  
      @ManyToMany
      @JoinColumn(name="uid")
      public User user;
  
      @ManyToMany
      @JoinColumn(name="movieid")
      private Movie movie;
  
      @Column(name = "rating")
      public Integer rating;
    }
  </code></pre>
  
  <p>I get the following runtime exception: Cannot read annotations for Preference.</p>
  
  <p>What am I missing?</p>
  
  <p>Thanks!</p>