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

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

m-m relations

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[3d3e59d]1package finki.paw5.model.entities;
[d427a07]2
[038c9f7]3import jakarta.persistence.*;
[d427a07]4import lombok.Data;
[fdd7961]5import lombok.RequiredArgsConstructor;
[d427a07]6
[fdfc6fa]7import java.time.LocalDate;
[d427a07]8import java.util.Date;
[c03e53b]9import java.util.List;
[d427a07]10
11@Data
12@Entity
[fdd7961]13@RequiredArgsConstructor
[d427a07]14@Table(name = "therapy")
15public class Therapy {
16
17 @Id
[038c9f7]18 @GeneratedValue(strategy = GenerationType.IDENTITY)
[d427a07]19 @Column(name = "id_therapy")
[ada7108]20 private Integer id;
[d427a07]21
22 @Column(name = "health_problem", nullable = false, length = 100)
23 private String healthProblem;
24
25 @Column(name = "start_date")
[fdfc6fa]26 private LocalDate startDate;
[d427a07]27
28 @Column(name = "end_date")
[fdfc6fa]29 private LocalDate endDate;
[d427a07]30
[c03e53b]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
[fdfc6fa]37 public Therapy(String healthProblem, LocalDate startDate, LocalDate endDate) {
[d427a07]38 this.healthProblem = healthProblem;
39 this.startDate = startDate;
40 this.endDate = endDate;
41 }
42}
Note: See TracBrowser for help on using the repository browser.