package sicura.entities;
// Generated 2-lug-2017 12.21.35 by Hibernate Tools 5.2.3.Final

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Home object for domain model class Destinatari.
 * @see sicura.entities.Destinatari
 * @author Hibernate Tools
 */
@Stateless
public class DestinatariHome {

	private static final Log log = LogFactory.getLog(DestinatariHome.class);

	@PersistenceContext
	private EntityManager entityManager;

	public void persist(Destinatari transientInstance) {
		log.debug("persisting Destinatari instance");
		try {
			entityManager.persist(transientInstance);
			log.debug("persist successful");
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}

	public void remove(Destinatari persistentInstance) {
		log.debug("removing Destinatari instance");
		try {
			entityManager.remove(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public Destinatari merge(Destinatari detachedInstance) {
		log.debug("merging Destinatari instance");
		try {
			Destinatari result = entityManager.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public Destinatari findById(Integer id) {
		log.debug("getting Destinatari instance with id: " + id);
		try {
			Destinatari instance = entityManager.find(Destinatari.class, id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
