Hi,
I have two classes Sale and SalesUnit. Sale class have a list of SalesUnit. Sale and SaleUnit has a one to one relationship. Can anyone tel me how to Map this relationship? I couldn't find anything like this on the web..
Sale class
Code:
public class Sale
{
private Long id;
private Date soldDate;
private List<SalesUnit> sales;
public Sale(List sales)
{
soldDate=new Date();
this.sales=sales;
}
public Sale()
{
soldDate=new Date();
}
}
SalesUnit class
Code:
public class SalesUnit
{
private Long salesID;
private Item item;
private Long quantity;
private Double total;
private Float discount;
/** Creates a new instance of SalesUnit */
public SalesUnit(Item item,Long quantity)
{
this.quantity=quantity;
this.item=item;
}
public SalesUnit()
{
}
}