Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.65 KB  |  hits: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to use @Formula (in Hibernate) to refer to the same (current) object
  2. @Entity
  3. @Table(name = "DB.APPL_SESSION")
  4. @AttributeOverrides({@AttributeOverride(name = "id", column = @Column(name = "APPL_SESSION_ID"))})
  5. @SequenceGenerator(name = "TableSequence", sequenceName = "DB.APPL_SESSION_SQ")
  6.  
  7. public class AiSession{
  8.  
  9. @Formula("(select sum(nvl(budg.AMT_OV,budg.AMT)) from DB.BUDGET budg where budg.APPL_SESSION_ID = APPL_SESSION_ID)")
  10. private LocalDate realSessionStartDate;
  11.        
  12. @Basic
  13. @Temporal(TemporalType.DATE)
  14. @Column(name = "START_OV_DT")
  15. private Date overrideStartDate;
  16.        
  17. @Formula("(select START_OV_DT from DB.APPL_SESSION)")
  18.        
  19. @Formula("START_OV_DT")