1 Reply Latest reply on Jan 18, 2008 12:03 PM by Vikram Chhetry

    Iterate List of entities

    Vikram Chhetry Newbie

      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
       "select r.iroleId, r.strDescription from Roles r order by r.iroleId")
       log.info("Query executed = " + list.size());
       Roles roles;
       ListIterator<?> it = list.listIterator();
       roles = (Roles) it.next();
       log.info("Id = " + roles.getIroleId());
       rolesList.add(new SelectItem(roles.getIroleId(), roles

      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.