@Override
public final <T> void updateEntity(
final Map<String, Object> pAddParam,
final T pEntity) throws Exception {
ColumnsValues columnsValues = evalColumnsValues(pAddParam, pEntity);
String whereStr = evalWhereForUpdate(pEntity, columnsValues);
prepareColumnValuesForUpdate(columnsValues, pEntity);
int result = getSrvDatabase().executeUpdate(pEntity.getClass()
.getSimpleName().toUpperCase(), columnsValues, whereStr);
if (result != 1) {
if (result == 0 && columnsValues.ifContains(VERSION_NAME)) {
throw new ExceptionWithCode(ISrvDatabase.DIRTY_READ, "dirty_read");
} else {
String query = hlpInsertUpdate.evalSqlUpdate(pEntity.getClass()
.getSimpleName().toUpperCase(), columnsValues,
whereStr);
throw new ExceptionWithCode(ISrvDatabase.ERROR_INSERT_UPDATE,
"It should be 1 row updated but it was "
+ result + ", query:\n" + query);
}
}
}