-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCategoria.java
54 lines (41 loc) · 1.09 KB
/
Categoria.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
44
45
46
47
48
49
50
51
52
53
54
package com.example.demo.model;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
@Entity
public class Categoria {
private Long id;
private String nome;
private List<Produto> produtos;
public Categoria() {
}
public Categoria(Long id, String nome) {
this.id = id;
this.nome = nome;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@ManyToMany(mappedBy = "categoria")
public List<Produto> getProdutos() {
return produtos;
}
public void setProdutos(List<Produto> produtos) {
this.produtos = produtos;
}
}