title: java.lang.String cannot be cast to [Ljava.lang.Object;
body: <p>I want to call course name in combobox and print  course Id which selected coursename How can I solve this problem?       </p>
  
  <pre><code>    public void coursename(){
       Session session = HibernateUtil.getSessionFactory().getCurrentSession();
       session.beginTransaction();
       Query query= session.createQuery("select a.courseName,a.courseId  from Semester e inner join e.course as a"); 
     for (Iterator it = query.iterate(); it.hasNext();) {
        Object  row[] = (Object[])   it.next();
        combocourse.addItem(row[0]);
          }        
         session.close();
     }
  
  
      private void combocourseActionPerformed(java.awt.event.ActionEvent evt) {                                            
  
  
    JComboBox combocourse = (JComboBox)evt.getSource();  
     Object row[] = (Object[])combocourse.getSelectedItem();  
      System.out.println("id"+row[1] ); 
  
         }
  </code></pre>