如何将Serialize对象添加到objectOutputStream?

时间:2016-11-04 03:58:43

标签: java objectoutputstream notserializableexception

我无法将我的序列化对象添加到objectOutputStream,发生了java.io.NotSerializableException运行时异常。请帮忙吗?这是我的代码段

ObjectOutputStream obout = new ObjectOutputStream(response.getOutputStream());
Session s = MySession.getSessionFactory().openSession();
Criteria c = s.createCriteria(LoanPlans.class);
Vector vec = new Vector();
for (LoanPlans l : (List<LoanPlans>) c.list()) {
    DataHolder ob = new DataHolder();
    ob.setPlanName(l.getName());
    ob.setCompany(l.getBusiness().getName());
    ob.setValuel(l.getLoanValue());
    ob.setImgpath("G:/Android Project/App Images/2-f_vectorized.png");
    vec.add(ob);
}
obout.writeObject(vec);
obout.flush();
obout.close();

0 个答案:

没有答案