Java jComboBox给出org.hibernate.PropertyAccessException错误
有两个jComboBox。。和2班。当窗体加载事件时,它将填充JCombox1,当ActionEvent触发时,它将加载另一个类,并选择JCombox1 我想从jComboBox.GetSelectItem方法中获取PersonelID,然后用这个id调用另一个类Java jComboBox给出org.hibernate.PropertyAccessException错误,java,swing,jcombobox,Java,Swing,Jcombobox,有两个jComboBox。。和2班。当窗体加载事件时,它将填充JCombox1,当ActionEvent触发时,它将加载另一个类,并选择JCombox1 我想从jComboBox.GetSelectItem方法中获取PersonelID,然后用这个id调用另一个类 Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: org.hibernate.PropertyAccessExcep
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
这是我的密码
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属性的getter/setter?作为注释而不是答案发布