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:
1.0 KB
|
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 = "regions")
|
---|
15 | @NoArgsConstructor
|
---|
16 | @AllArgsConstructor
|
---|
17 | @Getter
|
---|
18 | @Setter
|
---|
19 | public class Region {
|
---|
20 |
|
---|
21 | @Id
|
---|
22 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
23 | @Column(name = "id_region")
|
---|
24 | private Long id;
|
---|
25 |
|
---|
26 | @Column(name = "region_name")
|
---|
27 | private String name;
|
---|
28 |
|
---|
29 | @ManyToOne
|
---|
30 | @JoinColumn(name = "id_country", nullable = false)
|
---|
31 | @JsonBackReference
|
---|
32 | private Country country;
|
---|
33 |
|
---|
34 |
|
---|
35 | @OneToMany(mappedBy = "region", cascade = CascadeType.REMOVE, orphanRemoval = true)
|
---|
36 | @JsonManagedReference
|
---|
37 | private List<City> cityList;
|
---|
38 |
|
---|
39 | @OneToMany (mappedBy = "region", cascade = CascadeType.REMOVE, orphanRemoval = true)
|
---|
40 | @JsonManagedReference
|
---|
41 | private List<Location> locationList;
|
---|
42 |
|
---|
43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.