views:

611

answers:

1

Hi ,

There is 2 jComboBox .. and 2 Class . When form load event it will fill jComboBox1,when ActionEvent fired it will load another class with selection of the jComboBox1.I wanna get PersonelID from jComboBox.GetSelectItem method than call another class with this id. But gettin this error ;

Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of DBClasses.Unvan.unvanID

And Here is my Codes.;

 private void UnvanAl()
{
if (jComboBox1.getSelectedItem() != null) {
         EntityManagerFactory emf = Persistence.createEntityManagerFactory("SwingDenemePU");
    EntityManager em = emf.createEntityManager();
    Query sorgu = em.createQuery("select p from Personel p where p.unvanID = :id");
    int id = ((Unvan)jComboBox1.getSelectedItem()).getUnvanID();

    sorgu.setParameter("id", id);
    personelList = sorgu.getResultList();
    Object[] items = new Object[personelList.size()];
    for (int i = 0; i < personelList.size(); i++) {
        Personel personel = personelList.get(i);
        items[i]=personel.getPersonelAdSoyad();

    }

    DefaultComboBoxModel def = new DefaultComboBoxModel(items);
    jComboBox2.setModel(def);
    }

}


private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
   UnvanAl();

}
A: 

Do you have getters/setters for the property "unvanID"?

yes i have got.
Ibrahim AKGUN