title: How to use @Formula (in Hibernate) to refer to the same (current) object
body: <p>I have this class</p>
  
  <pre><code>@Entity
  @Table(name = "DB.APPL_SESSION")
  @AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "APPL_SESSION_ID"))})
  @SequenceGenerator(name = "TableSequence", sequenceName = "DB.APPL_SESSION_SQ")
  
  public class AiSession{
  
  @Formula("(select sum(nvl(budg.AMT_OV,budg.AMT)) from DB.BUDGET budg where budg.APPL_SESSION_ID = APPL_SESSION_ID)")
  private LocalDate realSessionStartDate;
  </code></pre>
  
  <p>In the above formula I was working with DB.BUDGET object and with the current object id ( APPL_SESSION_ID). But now I wanted only to work with the next member variable (StartDate) which is in AidApplicantYearSession class</p>
  
  <pre><code>@Basic
  @Temporal(TemporalType.DATE)
  @Column(name = "START_OV_DT")
  private Date overrideStartDate;
  </code></pre>
  
  <p>How should I write a formula that looks like the above on but uses only the object's member variable ? I came up with</p>
  
  <pre><code> @Formula("(select START_OV_DT from DB.APPL_SESSION)")
  </code></pre>
  
  <p>Is that the correct way? The logic for the two formulas is totaly different. </p>