-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
I am persisting a FastMoney instance with jadira the following way:
@Entity
public class MyEntity {
@Columns(columns = {@Column(name = "currency"), @Column(name = "amount")})
@Type(type = "org.jadira.usertype.moneyandcurrency.moneta.PersistentFastMoneyAmountAndCurrency")
@NotNull
private FastMoney amount;
}
This works for simple cases like FastMoney.of(100, "EUR") very well but fails if we add decimal values.
E.g. FastMoney.of(100.23, "EUR") will be present in a MyEntity object but after persisting the value 100 EUR will be present in the corresponding table.
I found the following workaround:
@Entity
public class MyEntity {
@Columns(columns = {@Column(name = "currency"), @Column(name = "amount")})
@Type(type = "org.jadira.usertype.moneyandcurrency.moneta.PersistentFastMoneyMinorAmountAndCurrency")
@NotNull
private FastMoney amount;
}
If I use PersistentFastMoneyMinorAmountAndCurrency it works as expected and 100,23 will be correctly inserted into the DB.
Is that intended behavior?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels