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

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

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

@Entity
public class Product extends Entiti implements Serializable {

	private static final long serialVersionUID = -3781064523477859914L;

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

	private String productName;

	@OneToMany(mappedBy = "product")
	private List<Item> items;

	@ManyToMany
	private List<Category> categories;

	public Long getProductId() {
		return productId;
	}

	public void setProductId(Long productId) {
		this.productId = productId;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

	public List<Item> getItems() {
		return items;
	}

	public void setItems(List<Item> items) {
		this.items = items;
	}

	public List<Category> getCategories() {
		return categories;
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

}

@@ -103,16 +103,49 @@
 .List;%0A%0A
+import javax.persistence.Column;%0A
 import j
@@ -632,16 +632,40 @@
 uctId;%0A%0A
+%09@Column(unique = true)%0A
 %09private

Add constraints Unique for Product.productName