source: trip-planner/src/main/java/finki/diplomska/tripplanner/models/City.java

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 
1package finki.diplomska.tripplanner.models;
2
3import com.fasterxml.jackson.annotation.JsonBackReference;
4import com.fasterxml.jackson.annotation.JsonManagedReference;
5import lombok.AllArgsConstructor;
6import lombok.Getter;
7import lombok.NoArgsConstructor;
8import lombok.Setter;
9
10import javax.persistence.*;
11import java.util.List;
12
13@Entity
14@Table(name = "cities")
15@NoArgsConstructor
16@AllArgsConstructor
17@Getter
18@Setter
19public 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.