All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.gentity.test.test1b_one_to_one.Desk Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version

package com.github.gentity.test.test1b_one_to_one;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import com.github.gentity.ToOneSide;

@Entity
@Table(name = "DESK")
public class Desk implements Serializable
{

    @Id
    @Column(name = "INVNO", length = 10)
    protected String invno;
    @Column(name = "MODEL", length = 100, nullable = false)
    protected String model;
    @OneToOne(mappedBy = "desk")
    protected Employee employee;
    final static ToOneSide relationTo$employee = ToOneSide.of((o -> o.employee), ((o,m) -> o.employee = m), Employee.relationTo$desk);

    public static Desk.Builder builder() {
        return new Desk.Builder();
    }

    public String getInvno() {
        return invno;
    }

    public void setInvno(String invno) {
        this.invno = invno;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public Employee getEmployee() {
        return (relationTo$employee.get(this));
    }

    public static class Builder {

        private final Desk instance = new Desk();

        public Desk build() {
            return instance;
        }

        public Desk.Builder invno(String invno) {
            instance.invno = invno;
            return this;
        }

        public Desk.Builder model(String model) {
            instance.model = model;
            return this;
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy