title: How to set default value in @Entity object field
body: <p>My entity has field that has one to one connection with another table. How can I set default value for that field. I was trying to to something like this</p>
  
  <pre><code>    @Column(columnDefinition = "int default 5")
      @OneToOne(cascade = CascadeType.ALL)
      private Admin admin;
  </code></pre>
  
  <p>But I get this error</p>
  
  <pre><code>@Column(s) not allowed on a @OneToOne
  </code></pre>
  
  <p>Is there a way to achive this without altering table in SQL?</p>
  
  <p>EDIT:</p>
  
  <p>Changed some stuff around. Now I have code like this.</p>
  
  <pre><code>@ManyToOne(cascade = CascadeType.ALL)
  @JoinColumn(name = "admin_id", referencedColumnName = "id", nullable = false, columnDefinition = "bigint(20) DEFAULT 5")
  private Admin admin;
  </code></pre>
  
  <p>I also added <code>@DynamicInsert</code> and <code>@DynamicUpdate</code> but it still doesn't work. I also want to note that those Admin objects already exist in DB and I don't want to create them again.</p>