package com.ejie.ad74a.dao.iml;


import javax.annotation.Resource;
import javax.sql.DataSource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.ejie.ad74a.dao.PruebaDao;
/**
 * Implementacion de la capa de persistencia para la prueba de humo
 * @author BICUGUAL
 *
 */
@Repository
public class PruebaDaoImpl implements PruebaDao {

	private static final Logger logger = LoggerFactory.getLogger(PruebaDaoImpl.class);
	
	private JdbcTemplate jdbcTemplate;
	
    @Resource
    public void setDataSource(DataSource dataSource) {
    	this.jdbcTemplate = new JdbcTemplate(dataSource);
    }
	
	@Override
	public Long countSolicitantes() {
		logger.info("counter sql");
		
		return this.jdbcTemplate.queryForObject("SELECT COUNT(1) FROM SOLICITANTES", Long.class);
		
	}

}
