53 lines
1.2 KiB
Java
53 lines
1.2 KiB
Java
package ch.progetto152.entity;
|
|
|
|
import jakarta.persistence.*;
|
|
import lombok.*;
|
|
|
|
import java.util.Objects;
|
|
|
|
@Entity
|
|
@Getter
|
|
@Setter
|
|
@NoArgsConstructor
|
|
@AllArgsConstructor
|
|
@ToString
|
|
@Table
|
|
public class User {
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@Column(name = "id")
|
|
private int id;
|
|
@Basic
|
|
@Column(name = "name")
|
|
private String name;
|
|
@Basic
|
|
@Column(name = "username")
|
|
private String username;
|
|
@Basic
|
|
@Column(name = "password")
|
|
private String password;
|
|
|
|
public User(String name, String username, String password) {
|
|
this.name = name;
|
|
this.username = username;
|
|
this.password = password;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o) {
|
|
return true;
|
|
}
|
|
if (o == null || getClass() != o.getClass()) {
|
|
return false;
|
|
}
|
|
User that = (User) o;
|
|
return id == that.id && Objects.equals(name, that.name) && Objects.equals(username, that.username) && Objects.equals(password, that.password);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return Objects.hash(id, name, username, password);
|
|
}
|
|
}
|