DAO 层:
public List getByProperty1(String property1, Object value1,
String property2, Object value2, String property3, Object value3) {
// TODO Auto-generated method stub
List list = new ArrayList();
try {
list = this.getSession().createCriteria(TbTask.class)
.add(
Expression.eq(property1, value1)).add(
Expression.eq(property2, value2)).add(
Expression.eq(property3, value3)).list();
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
方法调用:
List taskList = taskService.getTaskByProperty1("status", HConstants.TASK_STATUS_JIESHOU, "tasknum", HConstants.TASK_UPLOAD_ADVICES_LOG, "terminalnum", fname.substring(0, fname.lastIndexOf("_")));
TbTask task = taskList.get(0);
报错:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)