gpt4 book ai didi

java - 当 BigDecimal 已经在 DB (Oracle) 中设置时,指定 BigDecimal 的精度和小数位数是否有意义?

转载 作者:太空宇宙 更新时间:2023-11-04 09:07:53 26 4
gpt4 key购买 nike

当 BigDecimal 已经在 DB (Oracle) 中设置时,指定 BigDecimal 的精度和小数位数是否有意义?

@Column(name = "TEST_COLUMN", precision = 10, scale = 4)

对比

@Column(name = "TEST_COLUMN")

考虑到在数据库中列已指定如下:

NUMBER(10,4)

Hibernate 读取精度后是否保持不变,还是需要再次指定精度?

最佳答案

与columnDefinition一样,它仅与DDL生成相关。

来自 Javadoc:

/**
* (Optional) The precision for a decimal (exact numeric)
* column. (Applies only if a decimal column is used.)
* Value must be set by developer if used when generating
* the DDL for the column.
*/
int precision() default 0;

关于java - 当 BigDecimal 已经在 DB (Oracle) 中设置时,指定 BigDecimal 的精度和小数位数是否有意义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60006586/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com