Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Play Framework Ebean BigDecimal fraction

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?

like image 855
user2187263 Avatar asked Mar 22 '13 10:03

user2187263


1 Answers

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? :)

like image 77
Leo Avatar answered Oct 19 '22 06:10

Leo