60 lines
1.1 KiB
Java
60 lines
1.1 KiB
Java
package com.humanbooster.model;
|
|
|
|
import jakarta.persistence.*;
|
|
|
|
import java.util.List;
|
|
|
|
@Entity
|
|
public class User {
|
|
|
|
@Id
|
|
@GeneratedValue (strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
private String name;
|
|
private String email;
|
|
|
|
@OneToMany(mappedBy="author", cascade= CascadeType.ALL, fetch = FetchType.LAZY)
|
|
private List<Article> articles;
|
|
|
|
public User() {}
|
|
|
|
public User(String name, String email, List<Article> articles) {
|
|
this.name = name;
|
|
this.email = email;
|
|
this.articles = articles;
|
|
}
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(Long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public String getEmail() {
|
|
return email;
|
|
}
|
|
|
|
public void setEmail(String email) {
|
|
this.email = email;
|
|
}
|
|
|
|
public List<Article> getArticles() {
|
|
return articles;
|
|
}
|
|
|
|
public void setArticles(List<Article> articles) {
|
|
this.articles = articles;
|
|
}
|
|
}
|