Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. @Data
  2. @Entity
  3. public class Loan {
  4.  
  5. @Id
  6. @GeneratedValue(strategy = GenerationType.IDENTITY)
  7. private long id;
  8.  
  9. private String loanTitle;
  10.  
  11.  
  12. @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
  13. @JoinColumn(name = "loan_id")
  14. private List<Allowance> allowances;
  15. }
  16.  
  17. @Data
  18. @Entity
  19. public class Allowance {
  20.  
  21. @Id
  22. @GeneratedValue(strategy = GenerationType.IDENTITY)
  23. private Long id;
  24.  
  25. @ManyToOne
  26. private AllowanceType allowanceType;
  27.  
  28.  
  29. private Double allowanceAmount;
  30.  
  31. }
  32.  
  33. @Projection(name = "studyLoanSingle", types = {Loan.class})
  34. public interface LoanProjection {
  35.  
  36. String getLoanTitle();
  37.  
  38. List<AllowanceProjection> getAllowances();
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement