public void updateFile() {
		ArrayList<Product> products = new ArrayList<Product>();
		try {
			//products.clear();
			Statement s = connection.createStatement();
			// ((org.postgresql.jdbc3.AbstractJdbc3Statement)s).setQueryTimeout(1);

			String sql = "select * from stock";
			// ResultSet
			// resultset=((org.postgresql.jdbc3.AbstractJdbc3Statement)s).executeQuery(sql);
			ResultSet resultset = s.executeQuery(sql);
			// searchResult.clear();
			while (resultset.next()) {
				int id = resultset.getInt(1);
				String pname = resultset.getString(2);
				int amount = resultset.getInt(3);
				double price = resultset.getDouble(4);
				String feature = resultset.getString(5);
				products.add(new Product(id, pname, amount, price, feature));
			}
			System.out.println(products.size()+"beforewrite");
			oout = new ObjectOutputStream(new FileOutputStream(file));
			oout.writeObject(products);
			oout.close();
			System.out.println("all written");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}