简体   繁体   English

jComboBox给出org.hibernate.PropertyAccessException错误

[英]jComboBox giving org.hibernate.PropertyAccessException error

There is 2 jComboBox .. and 2 Class . 有2个jComboBox ..和2个Class。 When form load event it will fill jComboBox1 ,when ActionEvent fired it will load another class with selection of the jComboBox1. 加载表单事件时,它将填充jComboBox1 ,而触发ActionEvent ,它将加载具有jComboBox1选择的另一个类。

I wanna get PersonelID from jComboBox.GetSelectItem method than call another class with this id. 我想从jComboBox.GetSelectItem方法获取jComboBox.GetSelectItem不是使用此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();

}

您是否有属性“ unvanID”的获取器/设置器?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.hibernate.PropertyAccessException持续存在 - org.hibernate.PropertyAccessException on persist 休眠:org.hibernate.PropertyAccessException:IllegalArgumentException - Hibernate : org.hibernate.PropertyAccessException: IllegalArgumentException Hibernate Criteria - org.hibernate.PropertyAccessException:IllegalArgumentException - Hibernate Criteria - org.hibernate.PropertyAccessException: IllegalArgumentException 错误:-org.hibernate.PropertyAccessException:无法通过反射获取器获取字段值 - Error :- org.hibernate.PropertyAccessException: could not get a field value by reflection getter org.hibernate.PropertyAccessException:空值已分配给布尔类型的属性 - org.hibernate.PropertyAccessException: Null value was assigned to a property of boolean type org.hibernate.PropertyAccessException-如何从数据库中获取空值? - org.hibernate.PropertyAccessException - How to get a null value out of database? 为什么会出现org.hibernate.PropertyAccessException? - Why am I getting org.hibernate.PropertyAccessException? org.hibernate.PropertyAccessException,同时保持ManyToMany关系 - org.hibernate.PropertyAccessException while persisting ManyToMany relationship org.hibernate.PropertyAccessException:无法通过反射getter获取字段值 - org.hibernate.PropertyAccessException: could not get a field value by reflection getter of org.hibernate.PropertyAccessException:使用CGLIB设置异常的属性值 - org.hibernate.PropertyAccessException: exception setting property value with CGLIB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM