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.ManyToMany;
import javax.persistence.Table;
import com.github.gentity.ToManySide;
@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(mappedBy = "book")
protected List author = new ArrayList();
final static ToManySide , Author> relationTo$author = ToManySide.of((o -> o.author), Author.relationTo$book);
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 (relationTo$author.get(this));
}
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;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy