我正在使用 vaadin 的 FilterTable 插件。我在以下代码中收到 NullPointerException,但找不到原因。
cont = new IndexedContainer()
cont.addContainerProperty("Patient", String.class, null);
cont.addContainerProperty("Date Of Service", String.class,null);
cont.addContainerProperty("Provider", String.class, null);
Session session = HibernateUtil.getSessionFactory().openSession();
Iterator<?> iterator = session.createQuery("FROM ConvertVisitToBillingV WHERE ready_for_billing = '0'").list().iterator();
while(iterator.hasNext()){
ConvertVisitToBillingV var = (ConvertVisitToBillingV) iterator.next();
Visits v = (Visits) session.load(Visits.class, var.getVisitId());
Appointments app = (Appointments)session.load(Appointments.class, v.getAppointmentId());
t_id= var.getVisitId();
cont.addItem(t_id);
Resources res = (Resources)session.load(Resources.class, v.getReferredBy());
cont.getContainerProperty(t_id, "Patient").setValue(var.getFirstName() + " " + var.getLastName());
cont.getContainerProperty(t_id, "Date Of Service").setValue(new SimpleDateFormat("MM/dd/yyyy").format(v.getVisitDt()));
cont.getContainerProperty(t_id, "Provider").setValue(res.getResourceFirstName()+" "+res.getResourceLastName());
}
当它执行“cont.getContainerProperty(t_id,property).setValue() 行时,它偶尔会抛出 NullPointerException。没有得到它背后的原因。
这可能是什么原因,任何帮助!
谢谢!