Naween Banuka
Naween Banuka

Reputation: 106

How do I add Serialize object in to objectOutputStream?

I cant add my serialize object to objectOutputStream, the java.io.NotSerializableException runtime exception has occured. Please any one help ? This is my code snippet

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();

Upvotes: 0

Views: 42

Answers (0)

Related Questions