I got the following errors 4 time. There are 4 records in the DEPT table.
omain.Dept]
07:59:11,177 DEBUG - [ora.EmpDaoSql.findListDept] net.sf.hibernate.QueryExceptio
n: undefined alias: DEPTNO [SELECT DEPTNO, DNAME FROM edu.umich.umms.my_spring.d
omain.Dept]
My code is:------------------------------------------------------
String sqlString =
"SELECT DEPTNO, DNAME FROM Dept";
Session sess = getSession();
try {
resultList = sess.find(sqlString);
if (resultList != null) {
lst = new ArrayList();
}
for (it = resultList.iterator(); it.hasNext();) {
dept = (Dept)it.next();
nv = new NameValue(""+dept.getDEPTNO(), dept.getDNAME());
System.out.println(dept.getDEPTNO() +":"+ dept.getDNAME());
lst.add(nv);
}
return lst;
} catch (Exception e) {
LOGGER.debug(e.toString());
return null;
}
}
---------------------------------------------------
I don't wnat to use find("FROM dept") because I don't want to select all fields per records.
-Henry
|