Play Framework Ebean BigDecimal fraction
Asked Answered
B

1

6

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?

Bharat answered 22/3, 2013 at 10:26 Comment(0)
A
10

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

Alleviation answered 26/3, 2013 at 10:5 Comment(1)
thank you for your reply, I'll try that :) Haha, no it was the standard value so I was fine with that but yes I would like toBharat

© 2022 - 2024 — McMap. All rights reserved.