title: Integrity constraint violation
body: <p>Using the Play! Framework, i have the following two models:</p>
  
  <pre><code>@Entity
  public class User extends Model {
      public String firstName;
      public String lastName;
      public String email;
      public String password;
      public boolean isAdmin;
  
      @OneToMany(mappedBy="id", cascade=CascadeType.ALL)
      public List&lt;Site&gt; sites;
  
      public User(String firstName, String lastName, String email, String password) {
          this.firstName = firstName;
          this.lastName = lastName;
          this.email = email;
          this.password = password;
      }
  
      public static User connect(String email, String password) {
          return User.find("byEmailAndPassword",email,Crypto.passwordHash(password)).first();
      }
  
      public static User findUser(String email) {
          return User.find("byEmail",email).first();
      }
  
      public static User createUser(String firstName, String lastName, String email, String password, boolean isAdmin) {
          String pw = Crypto.passwordHash(password);
  
          User u = new User(firstName, lastName, email, pw);
          u.isAdmin = isAdmin;
          u.save();
          return u;
      }
  }
  
  @Entity
  public class Site extends Model {
  
      public UUID siteId;
  
      public String alias;
      public String protocol;
      public String host;
      public String username;
      public String password;
      public int port;
      public String rootPath;
  
      @Lob
      public String description;
  
      @ManyToOne
      public User user;
  
      public Site(User user, String alias, String protocol, String host, String username, String password) {
          this.user = user;
          this.alias = alias;
          this.protocol = protocol;
          this.host = host;
          this.username = username;
          this.password = password;
          this.port = 21;
          this.siteId = UUID.randomUUID();
  
      }
  }
  </code></pre>
  
  <p>When i try to run the following test:</p>
  
  <pre><code>public class BasicTest extends UnitTest {
  
      @Before
      public void setup() {
          Fixtures.deleteAll();
      }
  
      @Test
      public void createAndRetrieveUser() {
          new User("Jason","Miesionczek","something","something").save();
          User jason = User.find("byEmail", "something").first();
  
          assertNotNull(jason);
          assertEquals("Jason", jason.firstName);
      }
  
      @Test
      public void userSite() {
          new User("Jason","Miesionczek","something","something").save();
          User jason = User.find("byEmail", "something").first();
  
          new Site(jason, "InterEditor","ftp","something","something","something").save();
  
          List&lt;Site&gt; sites = Site.find("byUser", jason).fetch();
  
          assertEquals(1, sites.size());
  
          Site site1 = sites.get(0);
          assertNotNull(site1);
          assertEquals("InterEditor", site1.alias);
          assertNotNull(site1.siteId);
      }
  
  
  
  }
  </code></pre>
  
  <p>And i get this error:</p>
  
  <pre><code>A javax.persistence.PersistenceException has been caught, org.hibernate.exception.ConstraintViolationException: could not insert: [models.Site]
  In /test/BasicTest.java, line 27 :
  new Site(jason, "InterEditor","ftp","something","something","something").save();
  </code></pre>
  
  <p>Log output:</p>
  
  <pre><code>00:06:26,184 WARN  ~ SQL Error: -177, SQLState: 23000
  00:06:26,184 ERROR ~ Integrity constraint violation - no parent FK2753674FD92E0A
   table: USER in statement [insert into Site (id, alias, description, host, passw
  ord, port, protocol, rootPath, siteId, user_id, username) values (null, ?, ?, ?,
   ?, ?, ?, ?, ?, ?, ?)]
  </code></pre>
  
  <p>Can anyone help me understand what the error means and what i am doing wrong?</p>