source: Prototype Application/Paw5/src/main/java/finki/paw5/model/entities/Therapy.java@ c03e53b

main
Last change on this file since c03e53b was c03e53b, checked in by SazdovaEkaterina <sazdovaekaterina@…>, 16 months ago

m-m relations

  • Property mode set to 100644
File size: 1.0 KB
Line 
1package finki.paw5.model.entities;
2
3import jakarta.persistence.*;
4import lombok.Data;
5import lombok.RequiredArgsConstructor;
6
7import java.time.LocalDate;
8import java.util.Date;
9import java.util.List;
10
11@Data
12@Entity
13@RequiredArgsConstructor
14@Table(name = "therapy")
15public class Therapy {
16
17 @Id
18 @GeneratedValue(strategy = GenerationType.IDENTITY)
19 @Column(name = "id_therapy")
20 private Integer id;
21
22 @Column(name = "health_problem", nullable = false, length = 100)
23 private String healthProblem;
24
25 @Column(name = "start_date")
26 private LocalDate startDate;
27
28 @Column(name = "end_date")
29 private LocalDate endDate;
30
31 @ManyToMany
32 @JoinTable(name = "pet_needs_therapy",
33 joinColumns = @JoinColumn(name = "id_therapy"),
34 inverseJoinColumns = @JoinColumn(name = "id_pet"))
35 List<Pet> pets;
36
37 public Therapy(String healthProblem, LocalDate startDate, LocalDate endDate) {
38 this.healthProblem = healthProblem;
39 this.startDate = startDate;
40 this.endDate = endDate;
41 }
42}
Note: See TracBrowser for help on using the repository browser.