nIx*_*x.. 3 java mysql hibernate
我想在表格中创建一个精度为20且比例为3的十进制列,我做的是:
在pojo类中创建以下变量
private BigDecimal minimumValue;
Run Code Online (Sandbox Code Playgroud)在.hbm文件中我将属性值设置为
<property name="minimumValue" type="DECIMAL" precision="20" scale="3"/>
Run Code Online (Sandbox Code Playgroud)我收到以下错误:
org.hibernate.MappingException:无法确定:DECIMAL的类型,在表:TEST_DECIMAL,对于列:[org.hibernate.mapping.Column(minimumValue)]
有什么建议?
删除type ="DECIMAL".
type属性包含hibernate映射类型,这种映射类型将从Java转换为SQL数据类型.在您的情况下,您可以使用type ="big_decimal".