[jboss-user] [JBoss Seam] - Iterate List of entities
vikramchhetryy
do-not-reply at jboss.com
Fri Jan 18 11:14:43 EST 2008
Hi all,
I am getting class cast exception when I try to execute this code in this line
roles = (Roles) it.next();
public void loadRolesList() {
| List<Roles> list = (List<Roles>) em
| .createQuery(
| "select r.iroleId, r.strDescription from Roles r order by r.iroleId")
| .getResultList();
| log.info("Query executed = " + list.size());
| Roles roles;
| ListIterator<?> it = list.listIterator();
| while(it.hasNext()){
| roles = (Roles) it.next();
| log.info("Id = " + roles.getIroleId());
| rolesList.add(new SelectItem(roles.getIroleId(), roles
| .getStrDescription()));
| }
| }
|
I am not sure if it is the right way of doing it but I want to iterate the list in java only.
Any help would be appreciated.
Thanks,
Vikram
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121340#4121340
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121340
More information about the jboss-user
mailing list