Play Framework Ebean BigDecimal fraction

為{幸葍}努か 提交于 2019-12-07 03:52:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!