entity
@Table("t_dog")
public class Dog {
@Column
@ColDefine(type = ColType.FLOAT)
private BigDecimal price;
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
}
ColDefine,默认精度precision是2,但是实际插入时
public static void main(String[] arg) {
SimpleDataSource dataSource = new SimpleDataSource();
dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8");
dataSource.setUsername("root");
dataSource.setPassword("root");
DaoUp.me().setDataSource(dataSource);
Dao dao = DaoUp.me().dao();
Daos.createTablesInPackage(dao, Dog.class, true);
Dog dog = new Dog();
dog.setPrice(new BigDecimal(3.1415926));
dao.insert(dog);
}
结果数据库显示该字段的值为3.14159,既不是2,也不是我输入的精度,请问为啥?