Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. select * from table(DateOptions_Function('ID_OF_ENTITY'));
  2.  
  3. OPTION DATE
  4. -----------------------
  5. startDate 2012/09/01
  6. endDate 2013/04/01
  7. otherDate 2011/01/01
  8.  
  9. public class DateOptions {
  10. private LocalDate startDate;
  11. private LocalDate endDate;
  12. private LocalDate otherDate;
  13.  
  14. // getters and setters omitted
  15. }
  16.  
  17. @Formula("(select * from table(DateOptions_Function(ENTITY_ID)))")
  18. @Type(type = "mypackage.DateOptionsUserType")
  19. public DateOptions getDateOptions() {
  20. return dateOptions;
  21. }
  22.  
  23. public int[] sqlTypes() {
  24. return new int[] {Types.VARCHAR, Types.DATE};
  25. }
  26.  
  27. @Formula("(select DATE from table(DateOptions_Function(ENTITY_ID))) WHERE option='startDate'")
  28. private LocalDate startDate;
  29.  
  30. @Formula("(select DATE from table(DateOptions_Function(ENTITY_ID))) WHERE option='endDate'")
  31. private LocalDate endDate;
  32.  
  33. @Formula("(select DATE from table(DateOptions_Function(ENTITY_ID))) WHERE option='otherDate'")
  34. private LocalDate otherDate;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement