Skip to content

Commit

Permalink
Add entity roles
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhthien2000 committed Jan 2, 2024
1 parent fd35b8e commit 1fbd512
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/main/java/ndt/java/spring/enties/Role.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package ndt.java.spring.enties;

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.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Entity
@Table(name = "roles")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class Role {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

@Column(nullable = false, length = 50, unique = true)
private String name;

public Role(String name) {
this.name = name;
}

public Role(Integer id) {
this.id = id;
}

@Override
public String toString() {
return this.name;
}
}

0 comments on commit 1fbd512

Please sign in to comment.