sb = "select stockCode from table1";
(sqlserver2005)table1:
feild:
stockCode char(6);
stockName varchar(50);
list = (List) entityManager .createNativeQuery(sb.toString()).getResultList();
if(list!=null){
Iterator it = list.iterator();
while(it.hasNext()){
Object[] row = (Object[])it.next();
System.out.println(row[0].toString());
}
peiguo wrote:
It sounds like a simple problem, but you have to show us what is in sb, so we can know whether your query is correct, and by the way what database is this? Maybe someone can try for you.