// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference2dDAO.java
// public interface Preference2dDAO {
// 
// 	public void addPreference2d(Preference2d preference2d);
// 	public void updatePreference2d(Preference2d preference2d);
// 	public Preference2d getPreference2d(Long id);
// 	public List<Preference2d> getAllPreference2ds();
// 	public void deletePreference2d(Long id);
// 	public void deleteAllPreference2d();
// 	
// 	public Long count();
// 	
// 	public List<Preference2d> getPreferencesByUserId(Long userId);
// }
// 
// Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference2d.java
// @Entity
// @Table(name = "preference2d", catalog = "rrs")
// public class Preference2d implements java.io.Serializable {
// 
// 	private long id;
// 	private Long restaurantId;
// 	private Long userId;
// 	private Double score;
// 
// 	public Preference2d() {
// 	}
// 
// 	public Preference2d(long id) {
// 		this.id = id;
// 	}
// 
// 	public Preference2d(long id, Long restaurantId, Long userId, Double score) {
// 		this.id = id;
// 		this.restaurantId = restaurantId;
// 		this.userId = userId;
// 		this.score = score;
// 	}
// 
// 	@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 = "restaurant_id")
// 	public Long getRestaurantId() {
// 		return this.restaurantId;
// 	}
// 
// 	public void setRestaurantId(Long restaurantId) {
// 		this.restaurantId = restaurantId;
// 	}
// 
// 	@Column(name = "user_id")
// 	public Long getUserId() {
// 		return this.userId;
// 	}
// 
// 	public void setUserId(Long userId) {
// 		this.userId = userId;
// 	}
// 
// 	@Column(name = "score", precision = 22, scale = 0)
// 	public Double getScore() {
// 		return this.score;
// 	}
// 
// 	public void setScore(Double score) {
// 		this.score = score;
// 	}
// 
// }


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.Preference2dDAO;
import cn.com.chenyixiao.rrs.entity.Preference2d;
package cn.com.chenyixiao.rrs.dao.impl;




@Repository
public class Preference2dDAOImpl implements Preference2dDAO {

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

	
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference2dDAO.java
// public interface Preference2dDAO {
// 
// 	public void addPreference2d(Preference2d preference2d);
// 	public void updatePreference2d(Preference2d preference2d);
// 	public Preference2d getPreference2d(Long id);
// 	public List<Preference2d> getAllPreference2ds();
// 	public void deletePreference2d(Long id);
// 	public void deleteAllPreference2d();
// 	
// 	public Long count();
// 	
// 	public List<Preference2d> getPreferencesByUserId(Long userId);
// }
// 
// Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference2d.java
// @Entity
// @Table(name = "preference2d", catalog = "rrs")
// public class Preference2d implements java.io.Serializable {
// 
// 	private long id;
// 	private Long restaurantId;
// 	private Long userId;
// 	private Double score;
// 
// 	public Preference2d() {
// 	}
// 
// 	public Preference2d(long id) {
// 		this.id = id;
// 	}
// 
// 	public Preference2d(long id, Long restaurantId, Long userId, Double score) {
// 		this.id = id;
// 		this.restaurantId = restaurantId;
// 		this.userId = userId;
// 		this.score = score;
// 	}
// 
// 	@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 = "restaurant_id")
// 	public Long getRestaurantId() {
// 		return this.restaurantId;
// 	}
// 
// 	public void setRestaurantId(Long restaurantId) {
// 		this.restaurantId = restaurantId;
// 	}
// 
// 	@Column(name = "user_id")
// 	public Long getUserId() {
// 		return this.userId;
// 	}
// 
// 	public void setUserId(Long userId) {
// 		this.userId = userId;
// 	}
// 
// 	@Column(name = "score", precision = 22, scale = 0)
// 	public Double getScore() {
// 		return this.score;
// 	}
// 
// 	public void setScore(Double score) {
// 		this.score = score;
// 	}
// 
// }


// Path: src/main/java/cn/com/chenyixiao/rrs/dao/impl/Preference2dDAOImpl.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.Preference2dDAO;
import cn.com.chenyixiao.rrs.entity.Preference2d;

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




@Repository
public class Preference2dDAOImpl implements Preference2dDAO {

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

	
	public void addPreference2d(Preference2d preference2d) {