i have got uml diagram from projectant and into entity i have got method getTotalPrice()
So this is my class:
public class UOrder {
@OneToMany
private List<Product> products;
....
public BigDecimal getTotalPrice(){
BigDecimal b = new BigDecimal(0.0);
for(Product p : products){
b.add(p.getPrice());
}
return b;
}
}
It is good idea to do it like that ? logical busines into entity ? I have got only function in uml diagram not field totalPrice or something like that so i figure out that it must be like that ...