// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java
// public interface FoodDAO {
// 
// 	public void addFood(Food food);
// 	public void updateFood(Food food);
// 	public Food getFood(Long id);
// 	public List<Food> getAllFoods();
// 	public void deleteFood(Long id);
// 	public void deleteAllFoods();
// 	
// 	public Long count();
// 	
// 	public Food findByName(String name);
// }
// 
// Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java
// @Entity
// @Table(name = "food", catalog = "rrs")
// public class Food implements java.io.Serializable {
// 
// 	private long id;
// 	private String name;
// 
// 	public Food() {
// 	}
// 
// 	public Food(long id) {
// 		this.id = id;
// 	}
// 
// 	public Food(long id, String name) {
// 		this.id = id;
// 		this.name = name;
// 	}
// 
// 	@Id
// 	@GeneratedValue(strategy = GenerationType.IDENTITY)
// 	@Column(name = "id", unique = true, nullable = false)
// 	public long getId() {
// 		return this.id;
// 	}
// 
// 	public void setId(long id) {
// 		this.id = id;
// 	}
// 
// 	@Column(name = "name")
// 	public String getName() {
// 		return this.name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// }


import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import cn.com.chenyixiao.rrs.dao.FoodDAO;
import cn.com.chenyixiao.rrs.entity.Food;
package cn.com.chenyixiao.rrs.dao.impl;




@Repository
public class FoodDAOImpl implements FoodDAO {

	@Autowired
	private SessionFactory sessionFactory;
	
	private Session getCurrentSession() {
		return sessionFactory.getCurrentSession();
	}

	
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java
// public interface FoodDAO {
// 
// 	public void addFood(Food food);
// 	public void updateFood(Food food);
// 	public Food getFood(Long id);
// 	public List<Food> getAllFoods();
// 	public void deleteFood(Long id);
// 	public void deleteAllFoods();
// 	
// 	public Long count();
// 	
// 	public Food findByName(String name);
// }
// 
// Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java
// @Entity
// @Table(name = "food", catalog = "rrs")
// public class Food implements java.io.Serializable {
// 
// 	private long id;
// 	private String name;
// 
// 	public Food() {
// 	}
// 
// 	public Food(long id) {
// 		this.id = id;
// 	}
// 
// 	public Food(long id, String name) {
// 		this.id = id;
// 		this.name = name;
// 	}
// 
// 	@Id
// 	@GeneratedValue(strategy = GenerationType.IDENTITY)
// 	@Column(name = "id", unique = true, nullable = false)
// 	public long getId() {
// 		return this.id;
// 	}
// 
// 	public void setId(long id) {
// 		this.id = id;
// 	}
// 
// 	@Column(name = "name")
// 	public String getName() {
// 		return this.name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// }


// Path: src/main/java/cn/com/chenyixiao/rrs/dao/impl/FoodDAOImpl.java
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import cn.com.chenyixiao.rrs.dao.FoodDAO;
import cn.com.chenyixiao.rrs.entity.Food;

package cn.com.chenyixiao.rrs.dao.impl;




@Repository
public class FoodDAOImpl implements FoodDAO {

	@Autowired
	private SessionFactory sessionFactory;
	
	private Session getCurrentSession() {
		return sessionFactory.getCurrentSession();
	}

	
	public void addFood(Food food) {