com.github.gentity.test.test1b_one_to_one.Employee Maven / Gradle / Ivy
package com.github.gentity.test.test1b_one_to_one;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "EMPLOYEE")
public class Employee implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
protected Long id;
@Column(name = "FIRSTNAME", length = 100)
protected String firstname;
@Column(name = "SURNAME", length = 100)
protected String surname;
@OneToOne
@JoinColumn(name = "COMPANYCAR_ID")
protected Companycar companycar;
@OneToOne
@JoinColumn(name = "DESK_INVNO", nullable = false)
protected Desk desk;
public static Employee.Builder builder() {
return new Employee.Builder();
}
public Long getId() {
return id;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public Companycar getCompanycar() {
return companycar;
}
public void setCompanycar(Companycar companycar) {
this.companycar = companycar;
}
public Desk getDesk() {
return desk;
}
public void setDesk(Desk desk) {
this.desk = desk;
}
public static class Builder {
private final Employee instance = new Employee();
public Employee build() {
return instance;
}
public Employee.Builder firstname(String firstname) {
instance.firstname = firstname;
return this;
}
public Employee.Builder surname(String surname) {
instance.surname = surname;
return this;
}
public Employee.Builder companycar(Companycar companycar) {
instance.companycar = companycar;
return this;
}
public Employee.Builder desk(Desk desk) {
instance.desk = desk;
return this;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy