我的表格结构如下:
Student
{
STUDENT_ID varchar2(50) primary key,
NAME varchar2(50) not null,
MARKS number(30,8) not null
}
class Student
{
private String studentId;
private String name;
private double marks;
/** getters and setters of studentId and name are written over here **/
public double getMarks()
{
return marks;
}
public void setMarks(double marks)
{
this.marks = new BigDecimal(String.valueOf(marks)).setScale(6, BigDecimal.ROUND_HALF_UP).doubleValue();
}
}
<class name="com.example.bo.Student" table="Student">
<id name="studentId" column="STUDENT_ID">
<generator class="uuid" >
<param name="separator">-</param>
</generator>
</id>
<property name="name" column="NAME" />
<property name="marks" column="MARKS"/>
</class>
上面的代码运行正常。但由于某些原因,我想删除舍入功能,只需保持如下:
public void setMarks(double marks)
{
this.marks = marks;
}
但上述更改不起作用,之前的setter定义也会执行。