0 Replies Latest reply on Aug 6, 2008 3:00 AM by k dcosta

    Casting the result set

    k dcosta Newbie

      hi

      I am using seams generated entities.
      Using entity manager i fetched two columns from the database table.

      List idList=em.createQuery("select p.programId,p.programOid from Program p").getResultList();


      And i need to get the values. so i tried by iterating the list.I created a class with two variables and casted the list with the class.
      Iterator iterator = idList.iterator();
      
      while (iterator.hasNext()) {
      
       programB=(com.awb.action.ProgramBean) iterator.next();
      
      }


      My bean is as follows
      public class ProgramBean {
      
       private long programOid;
       private String programId;
      
      
       public long getProgramOid() {
       return programOid;
       }
       public void setProgramOid(long programOid) {
       this.programOid = programOid;
       }
       public String getProgramId() {
       return programId;
       }
       public void setProgramId(String programId) {
       this.programId = programId;
       }
      
      
      
      }


      But while casting im getting class cast exception. the retrieved columns are of long and string type which is in the bean also.
      Is there any other way to get the values.

      Plz hrlp.im in great need.


      Rgds
      kdcosta