package devopsdistilled.operp.server.data.entity.stock;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import devopsdistilled.operp.server.data.entity.Entiti;
import devopsdistilled.operp.server.data.entity.items.Item;

@Entity
public class StockKeeper extends Entiti<Long> {

	private static final long serialVersionUID = 6110042579005L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long stockId;
	private Long quantity;
	private Date date;

	@ManyToOne
	// (cascade=CascadeType.ALL)
	@JoinColumn(name = "itemId")
	private Item item;

	@ManyToOne
	// (cascade=CascadeType.ALL)
	@JoinColumn(name = "warehouseId")
	private Warehouse warehouse;

	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	public Warehouse getWarehouse() {
		return warehouse;
	}

	public void setWarehouse(Warehouse warehouse) {
		this.warehouse = warehouse;
	}

	public Long getQuantity() {
		return quantity;
	}

	public void setQuantity(Long quantity) {
		this.quantity = quantity;
	}

	public Long getStockId() {
		return stockId;
	}

	public void setStockId(Long stockId) {
		this.stockId = stockId;
	}

	public Date getDate() {
		return date;
	}

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

	@Override
	public Long id() {
		return stockId;
	}

	@Override
	public String toString() {
		return new String(getQuantity().toString() + " " + getItem() + " -> "
				+ getWarehouse());
	}

}

package devopsdistilled.operp.server.data.entity.stock;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

import devopsdistilled.operp.server.data.entity.Entiti;

@Entity
public class StockKeeper extends Entiti<Long> {

	private static final long serialVersionUID = 6110042579005L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long stockKeeperId;

	private Date stockUpdateDate;

	@ManyToOne
	private Stock stock;

	private Long quantity;

	@OneToOne
	private StockKeeper transferStockKeeper;

	public Long getStockKeeperId() {
		return stockKeeperId;
	}

	public void setStockKeeperId(Long stockKeeperId) {
		this.stockKeeperId = stockKeeperId;
	}

	public Date getStockUpdateDate() {
		return stockUpdateDate;
	}

	public void setStockUpdateDate(Date stockUpdateDate) {
		this.stockUpdateDate = stockUpdateDate;
	}

	public Stock getStock() {
		return stock;
	}

	public void setStock(Stock stock) {
		this.stock = stock;
	}

	public Long getQuantity() {
		return quantity;
	}

	public void setQuantity(Long quantity) {
		this.quantity = quantity;
	}

	public StockKeeper getTransferStockKeeper() {
		return transferStockKeeper;
	}

	public void setTransferStockKeeper(StockKeeper transferStockKeeper) {
		this.transferStockKeeper = transferStockKeeper;
	}

	@Override
	public Long id() {
		return getStockKeeperId();
	}

	@Override
	public String toString() {
		return new String(getQuantity() + " " + getStock().toString());
	}

}

Adjust StockKeeper Entity