java - Iterating a list with hibernate query -
i have usertable
uid username password 1 stephen 1542s 2 james 8452b
store procedure name: sp_gridview query: select * usertable
list list=null; list=hibernatetemplate. getsessionfactory().opensession() .createsqlquery("call sp_gridview").list(); for(int i=0; i<list.size(); i++) { system.out.println(list.get(i)); }
here not using generics because, not needed requirements. try iterate above list but, show result hash code.
output: [ljava.lang.object;@3c668d12.
how iterate list , value without hashcode.
it seems you're getting object
back, , object.tostring()
called when trying print prints that. solve it, can cast actual type of object
specific tostring()
method. such:
system.out.println((string)list.get(i));
Comments
Post a Comment