com.github.gentity.test.test1c_many_to_many.Book Maven / Gradle / Ivy
package com.github.gentity.test.test1c_many_to_many;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
@Entity
@Table(name = "BOOK")
public class Book implements Serializable
{
@Id
@Column(name = "ID")
protected Long id;
@Column(name = "TITLE", length = 100, nullable = false)
protected String title;
@ManyToMany
@JoinTable(name = "BOOK_AUTHOR", joinColumns = {
@JoinColumn(name = "BOOK_ID", referencedColumnName = "ID")
}, inverseJoinColumns = {
@JoinColumn(name = "AUTHOR_ID", referencedColumnName = "ID")
})
protected List author = new ArrayList();
public static Book.Builder builder() {
return new Book.Builder();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List getAuthor() {
return author;
}
public void setAuthor(List author) {
this.author = author;
}
public static class Builder {
private final Book instance = new Book();
public Book build() {
return instance;
}
public Book.Builder id(Long id) {
instance.id = id;
return this;
}
public Book.Builder title(String title) {
instance.title = title;
return this;
}
public Book.Builder author(List author) {
instance.author = author;
return this;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy