使用PlayFramework在YAML文件中映射BigInteger [英] Mapping BigInteger in YAML file with PlayFramework

查看:182
本文介绍了使用PlayFramework在YAML文件中映射BigInteger的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出以下模型示例:

@Entity
@Table(name="tierenforcers")
public class TierEnforcer extends Model {
    public BigInteger maxStorage; // expressed in B
}

如何在yml文件中映射BigInteger?如果我做类似的事情:

How can I map a BigInteger in my yml file? If I do something like:

TierEnforcer(joeTE):
    maxStorage:             5368709120

我在#play测试启动时没有收到错误,但是我的数据库中有一个NULL值(BigInteger在MySQL中创建为小数(19,2),但是将值持久化到JPA中似乎可以正常工作)

I don't get an error on #play test startup, but a NULL value in my database (BigInteger created as decimal(19,2) in MySQL, but persisting values into this seems to be working fine with JPA otherwise)

推荐答案

播放!在幕后使用 snakeyml .查看他们的网站以获取更多信息.

Play! uses snakeyml under the hood. Look at their website for more info.

查看此yaml示例,您可以尝试创建BigInteger,然后将其分配给您的实例

Looking at this yaml example you can try to create a BigInteger and then assign it to your instance

bigInteger(myBigInt): 123456789012345678901234567890123456789

TierEnforcer(joeTE):
    maxStorage:             myBigInt

希望它能起作用;)

这篇关于使用PlayFramework在YAML文件中映射BigInteger的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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