Hibernate映射BigDecimal的类型是什么

Hibernate映射BigDecimal的类型是什么

本文介绍了你会在MySQL中使用Java / Hibernate映射BigDecimal的类型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在经历了之前的开发中的代码故障之后,我意识到我需要移动所有基于钱的列来不使用浮点数学。在Java方面,这意味着使用BigDecimal,但是当使用Hibernate / JPA和MySQL 5时,什么是适合于创建该列的MySQL数据类型?

解决方案

DECIMAL和NUMERIC。

查看了解更多详情。

After going through the previous develop's trainwreck of code I realized I need to move all of the money based columns to not use floating point math. On the Java side this means using BigDecimal but when using Hibernate/JPA and MySQL 5 what would be the appropriate MySQL data type to make that column?

解决方案

DECIMAL and NUMERIC.

Have a look here for further details.

这篇关于你会在MySQL中使用Java / Hibernate映射BigDecimal的类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 05:03