问题
I am using the Play Framework with Ebean and H2 database.
The problem is, the BigDecimal
results in the DB script as:
sum decimal(38),
but what I want is:
sum decimal(38,2),
I already tried to define the value in the model like that:
@Digits(integer=6, fraction=2)
private BigDecimal sum;
Any ideas?
回答1:
You should use @Column(precision = 38, scale = 2) annotation. @Digits annotation seems to be for validation purposes, not for DDL generation.
Also 38 looks like overkill. Are you gonna store all money on earth? :)
来源:https://stackoverflow.com/questions/15568048/play-framework-ebean-bigdecimal-fraction