所查询的数据库表的结构是:index_two
里面的数据是:
查询代码是:
Id=402880374d1ef462014d1ef462370000;
String sql="select * from index_two whereoneid='"+id+"'";
List<IndexTwoEntity>list=systemService.findListbySql(sql);
public List<T> findListbySql(final Stringsql) {
Queryquerys = getSession().createSQLQuery(sql);
returnquerys.list();
}
返回的list的构建是:
存有的值是
展开list:
ElementData存有的值是:
[[Ljava.lang.Object;@61c8efbb,[Ljava.lang.Object;@4ef31024,[Ljava.lang.Object;@37a8d3fa,null, null, null, null, null, null, null]
展开ElementData:
三个元素[0]、[1]、[2]的值是:
[402880374d1ef462014d1ef4f0650003, A0001,402880374d1ef462014d1ef462370000, 3, Y]
[402880374d1ef462014d1ef51dbb0004, A0002,402880374d1ef462014d1ef462370000, 5, Y]
[402880374d1ef462014d1ef5bdf30007, C0005, 402880374d1ef462014d1ef462370000,11, Y]
往下展开:
写的遍历是:
for(IndexTwoEntity en:list){
System.out.println(en.getName());
}
错误!
Iterator<IndexTwoEntity> it=list.iterator();
while(it.hasNext()){
IndexTwoEntityin=it.next();
System.out.println(in.getName());
}也错