-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCategoria.java
More file actions
30 lines (27 loc) · 728 Bytes
/
Copy pathCategoria.java
File metadata and controls
30 lines (27 loc) · 728 Bytes
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
package application.model;
import application.record.CategoriaDTO;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "categorias")
@Getter
@Setter
@NoArgsConstructor
public class Categoria {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(nullable = false, unique = true)
private String nome;
public Categoria(CategoriaDTO dto) {
this.id = dto.id();
this.nome = dto.nome();
}
}