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

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.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

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

@Entity
@Table(uniqueConstraints = @UniqueConstraint(columnNames = { "productId",
		"brandId" }))
public class Item extends Entiti implements Serializable {

	private static final long serialVersionUID = 1137602696634935018L;

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

	@Column(unique = true)
	private String itemName;

	private Double price;

	@ManyToOne
	@JoinColumn(name = "productId")
	private Product product;

	@ManyToOne
	@JoinColumn(name = "brandId")
	private Brand brand;

	public Long getItemId() {
		return itemId;
	}

	public void setItemId(Long itemId) {
		this.itemId = itemId;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Brand getBrand() {
		return brand;
	}

	public void setBrand(Brand brand) {
		this.brand = brand;
	}

}

@@ -80,16 +80,54 @@
 zable;%0A%0A
+import javax.persistence.CascadeType;%0A
 import j
@@ -883,32 +883,59 @@
 ce;%0A%0A%09@ManyToOne
+(cascade = CascadeType.ALL)
 %0A%09@JoinColumn(na
@@ -990,16 +990,43 @@
 anyToOne
+(cascade = CascadeType.ALL)
 %0A%09@JoinC

Add (cascade = CascadeType.ALL) to @ManyToOne relations