javabean 代码:private Double testDouble;
public Double getTestDouble() {
return testDouble;
}
public void setTestDouble(Double testDouble) {
this.testDouble = testDouble;
}
当setTestDouble(null)时 getTestDouble会为0,我要的是null
高手给指点指点,谢谢了
我是用java hibernate建数据模型
@aPerformance()
@aComment("xxx率(%)")
@Column(name = "TESTDOUBLE",columnDefinition="NUMBER", nullable = true)
private Double testDouble;
当hibernate映射插入到表里的值就为0了
你把columnDefinition设为默认值试试。你定义的值为NUMBER,而要为null的话肯定要是一个对象类型。基本double类型的话会自动转化为默认0.00;
本回答被提问者采纳输出就是null啊