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

com.github.gentity.test.test1a_many_to_one.Company Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version

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;
import com.github.gentity.ToManySide;

@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();
    final static ToManySide , Employee> relationTo$employee = ToManySide.of((o -> o.employee), Employee.relationTo$company);

    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 (relationTo$employee.get(this));
    }

    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;
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy