Joined: Tue May 22, 2007 3:39 am Posts: 15
|
Financial operation.
I'm wondering about mapping type for ammount money in database defined as
numeric(10,2).
I have two option:
1. Mapping to BigDecimal
2. Maping to Double
In this case I'd like move access type to field and give
Long getter and setter in which is doing appropriate conversion from/to Double (with multiply/ divide 100):
//return salary in cent
public Long getSalary() {
return Util.getAsLong(amount);
}
public void setSalary(Long ammount) {
this.amount = Util.getAsDouble(amount);
}
In this case all financial operation are doing on Long (cents).
I know that using BigDecimal is comfortable solution buy not most efficient and fast.
What do you think about solution witch Double ?
What are you using for financial operations ?
Thanks in advance
gienas
|
|