@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
    @Override
    public void create(Medicine medicine) {
        EntityManager em = emf.createEntityManager();
        Query q = em.createQuery("Select m from Medicine m where m.name=:name and m.releaseForm=:releaseForm and m.ages=:ages and m.quantityPerPack=:quantityPerPack");
        q.setParameter("name", medicine.getName());
        q.setParameter("releaseForm", medicine.getReleaseForm());
        q.setParameter("ages", medicine.getAges());
        q.setParameter("quantityPerPack", medicine.getQuantityPerPack());
        List<Medicine> m;
        try {
            m = q.getResultList();
            if (m != null && m.isEmpty()) {
                em.getTransaction().begin();
                em.persist(medicine);
                em.getTransaction().commit();
            }
        } catch (NoResultException ex) {
            em.getTransaction().begin();
            em.persist(medicine);
            em.getTransaction().commit();
        }
        em.close();
    }