-
Notifications
You must be signed in to change notification settings - Fork 2
/
CidadeTable.java
43 lines (34 loc) · 1007 Bytes
/
CidadeTable.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package br.com.treinamento.cleanarch.dataprovider.entity;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import com.fasterxml.jackson.annotation.JsonBackReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity(name = "cidade")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CidadeTable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id_cidade")
private Long id;
@Column(name = "nm_cidade")
private String nome;
@ManyToOne
@JoinColumn(name = "id_estado")
private EstadoTable estado;
@JsonBackReference
@OneToMany(mappedBy = "cidade")
private List<BairroTable> bairros;
}