
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 0.65 KB | hits: 34 | expires: Never
How to use @Formula (in Hibernate) to refer to the same (current) object
@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;
@Basic
@Temporal(TemporalType.DATE)
@Column(name = "START_OV_DT")
private Date overrideStartDate;
@Formula("(select START_OV_DT from DB.APPL_SESSION)")
@Formula("START_OV_DT")