[6a3a178] | 1 | package finki.diplomska.tripplanner.models;
|
---|
| 2 |
|
---|
| 3 | import com.fasterxml.jackson.annotation.JsonBackReference;
|
---|
| 4 | import lombok.AllArgsConstructor;
|
---|
| 5 | import lombok.Getter;
|
---|
| 6 | import lombok.NoArgsConstructor;
|
---|
| 7 | import lombok.Setter;
|
---|
| 8 | import net.minidev.json.annotate.JsonIgnore;
|
---|
| 9 |
|
---|
| 10 | import javax.persistence.*;
|
---|
| 11 | import java.util.List;
|
---|
| 12 |
|
---|
| 13 | @Entity
|
---|
| 14 | @Table(name = "locations")
|
---|
| 15 | @NoArgsConstructor
|
---|
| 16 | @AllArgsConstructor
|
---|
| 17 | @Getter
|
---|
| 18 | @Setter
|
---|
| 19 | public class Location {
|
---|
| 20 | @Id
|
---|
| 21 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 22 | @Column(name = "id_location")
|
---|
| 23 | private Long id;
|
---|
| 24 |
|
---|
| 25 | @Column(name = "location_name")
|
---|
| 26 | private String name;
|
---|
| 27 |
|
---|
| 28 | @Column(name = "location_description")
|
---|
| 29 | private String description;
|
---|
| 30 |
|
---|
| 31 | private String address;
|
---|
| 32 |
|
---|
| 33 | private String priority;
|
---|
| 34 |
|
---|
| 35 | private int duration;
|
---|
| 36 |
|
---|
| 37 | @Lob
|
---|
| 38 | @JsonIgnore
|
---|
| 39 | private byte[] photo;
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | @ManyToMany
|
---|
| 43 | @JoinTable(
|
---|
| 44 | name = "recommended_companion",
|
---|
| 45 | joinColumns = @JoinColumn(name = "id_location"),
|
---|
| 46 | inverseJoinColumns = @JoinColumn(name = "id_companion"))
|
---|
| 47 | @com.fasterxml.jackson.annotation.JsonIgnore
|
---|
| 48 | private List<Companion> companionList;
|
---|
| 49 |
|
---|
| 50 | @ManyToOne
|
---|
| 51 | @JsonBackReference
|
---|
| 52 | @JoinColumn(name = "id_region", nullable = false)
|
---|
| 53 | private Region region;
|
---|
| 54 |
|
---|
| 55 | @ManyToOne
|
---|
| 56 | @JsonBackReference
|
---|
| 57 | @JoinColumn(name = "id_city", nullable = true)
|
---|
| 58 | private City city;
|
---|
| 59 |
|
---|
| 60 | @ManyToMany(mappedBy = "locationList")
|
---|
| 61 | @com.fasterxml.jackson.annotation.JsonIgnore
|
---|
| 62 | private List<Planner> plannerList;
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | @ManyToMany
|
---|
| 66 | @JoinTable(
|
---|
| 67 | name = "locations_belong",
|
---|
| 68 | joinColumns = @JoinColumn(name = "id_location"),
|
---|
| 69 | inverseJoinColumns = @JoinColumn(name = "id_category"))
|
---|
| 70 | @com.fasterxml.jackson.annotation.JsonIgnore
|
---|
| 71 | private List<Category> categoryList;
|
---|
| 72 |
|
---|
| 73 |
|
---|
| 74 | }
|
---|