@Override
	public void persist(Vector<StockEntry> data) throws Exception {
        for (StockEntry entry : data) {
		    // persist image
		    EntityManager em = null;
		    try {
		    	em = EMF.get().createEntityManager();
			    em.getTransaction().begin();
			    em.createQuery("delete from StockEntry").executeUpdate();
			    em.persist(entry);
		    	em.getTransaction().commit();
		    } catch (Exception e) {
		    	if (em != null) {
			    	em.getTransaction().rollback();
		    	}
		    	throw e;
		    } finally {
		    	if (em != null) {
		    		em.close();
		    	}
		    }
        }
	}