播放框架Ebean BigDecimal分数 [英] Play Framework Ebean BigDecimal fraction

查看:105
本文介绍了播放框架Ebean BigDecimal分数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Play Framework与Ebean和H2数据库配合使用.

I am using the Play Framework with Ebean and H2 database.

问题在于,BigDecimal在数据库脚本中的结果为:

The problem is, the BigDecimal results in the DB script as:

  sum                       decimal(38),

但是我想要的是:

  sum                       decimal(38,2),

我已经尝试过像这样在模型中定义值:

I already tried to define the value in the model like that:

    @Digits(integer=6, fraction=2)
    private BigDecimal sum;

有什么想法吗?

推荐答案

您应使用 @Column(精度= 38,比例= 2)批注. @Digits批注似乎是出于验证目的,而不是DDL生成.

You should use @Column(precision = 38, scale = 2) annotation. @Digits annotation seems to be for validation purposes, not for DDL generation.

38看上去也算是过分杀伤力了.你要把所有的钱都存到地上吗? :)

Also 38 looks like overkill. Are you gonna store all money on earth? :)

这篇关于播放框架Ebean BigDecimal分数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆