mirror of https://github.com/bvn13/VoidForum.git
33 lines
556 B
Java
33 lines
556 B
Java
|
package ru.bvn13.voidforum.models;
|
||
|
|
||
|
import lombok.Getter;
|
||
|
import lombok.Setter;
|
||
|
|
||
|
import javax.persistence.*;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* bvn13 <mail4bvn@gmail.com>.
|
||
|
*/
|
||
|
@Entity
|
||
|
@Table(name = "tags")
|
||
|
@Getter
|
||
|
@Setter
|
||
|
public class Tag extends BaseModel {
|
||
|
|
||
|
@Column(nullable = false, unique = true)
|
||
|
private String name;
|
||
|
|
||
|
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "tags")
|
||
|
private List<Post> posts = new ArrayList<>();
|
||
|
|
||
|
public Tag(){
|
||
|
|
||
|
}
|
||
|
|
||
|
public Tag(String name){
|
||
|
this.setName(name);
|
||
|
}
|
||
|
}
|