package com.palmnest.dao.virtfood.impl;

import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.dao.virtfood.VirtFoodConfigDao;
import com.palmnest.model.virtfood.VirtFoodConfig;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("virtFoodConfigDao")
public class VirtFoodConfigDaoImpl extends GenericDaoHibernate<VirtFoodConfig, Long> implements VirtFoodConfigDao {

	public VirtFoodConfigDaoImpl() {
		super(VirtFoodConfig.class);
	}

	@Override
	public VirtFoodConfig getByFoodId(Long food_id) {

		String               strHql = "from VirtFoodConfig where food_id=?  ";
		List<VirtFoodConfig> list   = getSession().createQuery(strHql).setLong(0, food_id).list();
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}


}
