com.github.gentity.test.test1a_many_to_one.Company Maven / Gradle / Ivy
package com.github.gentity.test.test1a_many_to_one;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name = "COMPANY")
public class Company implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
protected Long id;
@Column(name = "NAME", length = 100, nullable = false)
protected String name;
@OneToMany(mappedBy = "company")
protected List employee = new ArrayList();
public static Company.Builder builder() {
return new Company.Builder();
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List getEmployee() {
return employee;
}
public void setEmployee(List employee) {
this.employee = employee;
}
public static class Builder {
private final Company instance = new Company();
public Company build() {
return instance;
}
public Company.Builder name(String name) {
instance.name = name;
return this;
}
public Company.Builder employee(List employee) {
instance.employee = employee;
return this;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy