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

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

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

@MappedSuperclass
public abstract class BusinessDescRow<D extends BusinessDesc<?, ?>> extends
		Entiti<Long> {

	private static final long serialVersionUID = 9140270277994676490L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	protected Long businessDescRowId;

	@ManyToOne
	protected D businessDesc;

	@OneToOne
	protected Item item;

	private Double rate;
	private Long quantity;
	private Double amount;

	public Item getItem() {
		return item;
	}

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

	public Double getRate() {
		return rate;
	}

	public void setRate(Double rate) {
		this.rate = rate;
	}

	public Long getQuantity() {
		return quantity;
	}

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

	public Double getAmount() {
		return amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

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

	@Override
	public String toString() {
		return new String(getQuantity().toString() + " "
				+ getItem().getItemName() + " at " + getRate().toString());
	}

}
@@ -761,16 +761,22 @@
 ble rate
+ = 0.0
 ;%0A%09priva
@@ -791,16 +791,21 @@
 quantity
+ = 0L
 ;%0A%09priva
@@ -820,16 +820,22 @@
 e amount
+ = 0.0
 ;%0A%0A%09publ
@@ -1029,24 +1029,64 @@
 ate = rate;%0A
+%09%09setAmount(getRate() * getQuantity());%0A
 %09%7D%0A%0A%09public 
@@ -1167,24 +1167,24 @@
 quantity) %7B%0A
-
 %09%09this.quant
@@ -1191,32 +1191,72 @@
 ity = quantity;%0A
+%09%09setAmount(getRate() * getQuantity());%0A
 %09%7D%0A%0A%09public Doub

Set defaults for attribute & update Amount on quantity/rate update