package com.ifish.daoImpl;

import java.math.BigInteger;

import org.springframework.stereotype.Repository;

import com.ifish.dao.LiveMessageDao;
import com.ifish.entity.LiveMessage;
import com.ifish.hibernate.HibernateBaseDao;

/** 
 * @ClassName: LiveMessageDaoImpl
 * @Description: TODO 
 * @author ggw 
 *  
 */

@Repository
public class LiveMessageDaoImpl extends HibernateBaseDao<LiveMessage, Integer> implements LiveMessageDao {

	@Override
	protected Class<LiveMessage> getEntityClass() {
		return LiveMessage.class;
	}

	@Override
	public int getLiveMessageCount(Integer roomId) {
		String sql = "SELECT COUNT(*) FROM tbl_live_message WHERE room_id=?";
		return ((BigInteger)getSession().createSQLQuery(sql).setInteger(0, roomId).uniqueResult()).intValue();
	}
	
}
