Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.neeti.neg.dao.impl; import com.neeti.neg.dao.GamesDao; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; import org.springframework.jdbc.core.namedparam.SqlParameterSource; /** * * @author neeti */ public class GamesDaoImpl implements GamesDao { private NamedParameterJdbcTemplate namedParameterJdbcTemplate; private static final String SQL_GETGAMEREF = "SELECT game_id FROM games where game_reqid= :game_reqid"; @Override public int getGameId(String gameRefId) { SqlParameterSource namedParameters = new MapSqlParameterSource("game_reqid", gameRefId); int temp = 0; try { temp = this.namedParameterJdbcTemplate.queryForInt(SQL_GETGAMEREF, namedParameters); } catch (Exception e) { temp = 0; } finally { //status=(boolean) temp; return temp; } } }