title: hibernate @formula select only field
body: <p>I am following a tutorial on hibernate and have a field on the entity that should be select only. However, upon save of entity the filed is in the insert query and ending up on error. Please assist.</p>
  
  <pre><code>@Entity
  @Table(name="finances_user")
  @Access(value=AccessType.PROPERTY)
  public class User {
  
      ...
      private Date birthDate;
  
      @Formula("lower(datediff(curdate(), birth_date)/365)")
      private int age;
  
      @Column("BIRTH_DATE")
      public int getAge() {
          return age;
      }
  
      public void setAge(int age) {
          this.age = age;
      }
      ...
  }
  </code></pre>
  
  <p>I have tried the below as well,</p>
  
  <pre><code>@Formula(value = "select lower(datediff(curdate(), birth_date)/365) from finances_user l where l.USER_ID = userId")
  </code></pre>
  
  <p>Below is the error stack, the field 'age' is used in the insert query. It should be a select only field.</p>
  
  <pre><code>DEBUG - insert into finances_user (age, BIRTH_DATE, CREATED_BY, CREATED_DATE, EMAIL_ADDRESS, FIRST_NAME, LAST_NAME, LAST_UPDATED_BY, LAST_UPDATED_DATE, USER_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
  DEBUG - could not execute statement [n/a]
  com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'age' in 'field list'
  </code></pre>