/**
 * 
 */
package com.cheer.petstore.dao.impl;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.cheer.petstore.dao.PetDao;
import com.cheer.petstore.domain.Pet;

/**
 * @author Cheer
 * @date 2017年10月25日
 * @time 下午2:45:03
 */
public class PetDaoImpl implements PetDao
{
    private static final Logger LOGGER = LogManager.getLogger(PetDaoImpl.class);
  
	private Session session;
	
	private Transaction tx ;
	
	public PetDaoImpl(Session session, Transaction tx)
	{
		this.session = session;
		this.tx = tx;
	}
	
	@Override
	public void save(Pet pet)
	{
		tx.begin();
		session.persist(pet);
		tx.commit();
	}

}
