Hi all,
probably my question was answered before, but I could not find anything...
I have the following property mapping:
<property name="amount" column="amount" type="Currency"/>
Currency is my own class:
public class Currency {
public Currency(long dollars, long cents) {
if (dollars >= 0)
{
currencyCents = (dollars * 100) + Math.abs(cents);
}
else
{
currencyCents = (dollars * 100) - Math.abs(cents);
}
}
// various methods
protected long currencyCents;
}
I want the database table to store currencyCents field in "amount" column.
Is there any way to do it??
Thanks!
|