Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
960 bytes
|
Line | |
---|
1 | package finki.diplomska.tripplanner.models;
|
---|
2 |
|
---|
3 | import com.fasterxml.jackson.annotation.JsonBackReference;
|
---|
4 | import com.fasterxml.jackson.annotation.JsonManagedReference;
|
---|
5 | import lombok.AllArgsConstructor;
|
---|
6 | import lombok.Getter;
|
---|
7 | import lombok.NoArgsConstructor;
|
---|
8 | import lombok.Setter;
|
---|
9 |
|
---|
10 | import javax.persistence.*;
|
---|
11 | import java.util.List;
|
---|
12 |
|
---|
13 | @Entity
|
---|
14 | @Table(name = "cities")
|
---|
15 | @NoArgsConstructor
|
---|
16 | @AllArgsConstructor
|
---|
17 | @Getter
|
---|
18 | @Setter
|
---|
19 | public class City {
|
---|
20 | @Id
|
---|
21 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
22 | @Column(name = "id_city")
|
---|
23 | private Long id;
|
---|
24 |
|
---|
25 | @Column(name = "city_name")
|
---|
26 | private String name;
|
---|
27 |
|
---|
28 | @Column(name = "city_description")
|
---|
29 | private String description;
|
---|
30 |
|
---|
31 | @ManyToOne
|
---|
32 | @JoinColumn(name = "id_region", nullable = false)
|
---|
33 | @JsonBackReference
|
---|
34 | private Region region;
|
---|
35 |
|
---|
36 | @OneToMany(mappedBy = "city", cascade = CascadeType.REMOVE, orphanRemoval = true)
|
---|
37 | @JsonManagedReference
|
---|
38 | private List<Location> locationList;
|
---|
39 |
|
---|
40 |
|
---|
41 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.