com.github.gentity.test.test1b_one_to_one.Companycar 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.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "COMPANYCAR")
public class Companycar implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
protected Long id;
@Column(name = "REGISTRATION", length = 100, nullable = false)
protected String registration;
@OneToOne(mappedBy = "companycar")
protected Employee employee;
public static Companycar.Builder builder() {
return new Companycar.Builder();
}
public Long getId() {
return id;
}
public String getRegistration() {
return registration;
}
public void setRegistration(String registration) {
this.registration = registration;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(Employee employee) {
this.employee = employee;
}
public static class Builder {
private final Companycar instance = new Companycar();
public Companycar build() {
return instance;
}
public Companycar.Builder registration(String registration) {
instance.registration = registration;
return this;
}
public Companycar.Builder employee(Employee employee) {
instance.employee = employee;
return this;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy