package bg.car_wash.areas.customer.entity;

import bg.car_wash.areas.car.entity.Car;

import javax.persistence.*;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "customers")
public class Customer {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	@Column(name = "name", nullable = false)
	@Size(min = 3, max = 100)
	private String name;

	@Column(name = "phone_number", nullable = false)
	@Size(min = 10, max = 15)
	private String phoneNumber;

	@Basic
	private Date date;

	@Basic
	private int discount;

	@OneToMany(targetEntity = Car.class, cascade = CascadeType.ALL, mappedBy = "owner")
	private List<Car> cars;

	public Customer() {
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public int getDiscount() {
		return discount;
	}

	public void setDiscount(int discount) {
		this.discount = discount;
	}
}

package bg.car_wash.areas.customer.entity;

import bg.car_wash.areas.car.entity.Car;

import javax.persistence.*;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "customers")
public class Customer {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	@Column(name = "name", nullable = false)
	@Size(min = 3, max = 100)
	private String name;

	@Column(name = "phone_number", nullable = false)
	@Size(min = 10, max = 15)
	private String phoneNumber;

	@Basic
	private Date date;

	@Basic
	private int discount;

	@OneToMany(targetEntity = Car.class, cascade = CascadeType.ALL, mappedBy = "owner")
	private List<Car> cars;

	public Customer() {
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPhoneNumber() {
		return phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public int getDiscount() {
		return discount;
	}

	public void setDiscount(int discount) {
		this.discount = discount;
	}

	public List<Car> getCars() {
		return cars;
	}

	public void setCars(List<Car> cars) {
		this.cars = cars;
	}
}

add getter and setter