有人可以帮助我在我的代码中出错吗?我有以下结果对象,我将其设置为实体并尝试在数据库中保存或更新。 我的情景是
07 - > A,99.44%
B,78.89%
08 - > A,99.31%
Object [] results = [[A, 07, 99.44%],
[B, 07, 78.89%],
[A, 08, 99.31%]];
for (Object[] info : results) {
Test testObj = new testObj();
if (info[0].toString().equals("A")) {
testObj.setMon(info[1].toString());
testObj.setAPercent(info[2].toString());
this.dao.save(testObj);
}
if (info[0].toString().equals("B")) {
testObj.setMon(info[1].toString());
testObj.setBPercent(info[2].toString());
this.dao.save(testObj);
}
休眠:选择errorcount0_.MONTH为MONTH1_18_0_, errorcount0_.A_PERCENT为A_ERROR_PERCENT2_18_0_, errorcount0_.B_PERCENT为B_ERROR_PERCENT3_18_0_来自 ERROR_COUNT_MONTHLY errorcount0_其中errorcount0_.MONTH =?休眠: 插入ERROR_COUNT_MONTHLY(A_PERCENT,MONTH)值(?,?) Hibernate:选择errorcount0_.MONTH为MONTH1_18_0_, errorcount0_.A_PERCENT为A_ERROR_PERCENT2_18_0_, errorcount0_.B_PERCENT为B_ERROR_PERCENT3_18_0_来自 ERROR_COUNT_MONTHLY errorcount0_其中errorcount0_.MONTH =?休眠: 更新ERROR_COUNT_MONTHLY设置A_PERCENT =?,B_PERCENT =? MONTH =? Hibernate:选择errorcount0_.MONTH为MONTH1_18_0_, errorcount0_.A_PERCENT为A_ERROR_PERCENT2_18_0_, errorcount0_.B_PERCENT为B_ERROR_PERCENT3_18_0_来自 ERROR_COUNT_MONTHLY errorcount0_其中errorcount0_.MONTH =?休眠: 插入ERROR_COUNT_MONTHLY(A_PERCENT,MONTH)值(?,?)
I am getting output as below
MONTH A_PERCENT B_PERCENT
08 99.31% 78.89%
07 99.44% 78.89%
The actual output should look like
MONTH A_PERCENT B_PERCENT
08 99.31% null
07 99.44% 78.89%