List of usage examples for org.springframework.jdbc.core.namedparam MapSqlParameterSource addValue
public MapSqlParameterSource addValue(String paramName, @Nullable Object value)
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
public List<Word> findWords(String text) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_WORD + " FROM ftb_word w" + " WHERE word_text = :word_text" + " ORDER BY word_id"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("word_text", text); LOG.info(sql);// www . j a v a 2 s. c o m TreebankDaoImpl.LogParameters(paramSource); @SuppressWarnings("unchecked") List<Word> words = jt.query(sql, paramSource, new WordMapper(this.treebankServiceInternal)); return words; }
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
public List<Word> findWords(Phrase phrase) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_WORD + " FROM ftb_word w, ftb_phrase_unit pu, ftb_phrase_child pc" + " WHERE word_id=punit_word_id AND punit_phrase_id = pchild_child_id AND pchild_phrase_id = :pchild_phrase_id" + " ORDER BY punit_position"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("pchild_phrase_id", phrase.getId()); LOG.info(sql);// w w w . j a va2s . c om TreebankDaoImpl.LogParameters(paramSource); @SuppressWarnings("unchecked") List<Word> words = jt.query(sql, paramSource, new WordMapper(this.treebankServiceInternal)); return words; }
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
@Override public List<PhraseInternal> findChildren(Phrase phrase) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_PHRASE + " FROM ftb_phrase" + " WHERE phrase_parent_id = :phrase_id" + " ORDER BY phrase_position"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("phrase_id", phrase.getId()); LOG.info(sql);/*from w w w. j a v a2s. c o m*/ TreebankDaoImpl.LogParameters(paramSource); @SuppressWarnings("unchecked") List<PhraseInternal> children = jt.query(sql, paramSource, new PhraseMapper(this.treebankServiceInternal)); return children; }
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
@SuppressWarnings("unchecked") public List<Integer> findSentenceIds(int minId, int maxId) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT sentence_id FROM ftb_sentence" + " WHERE sentence_id >= :min_id" + " AND sentence_id <= :max_id" + " ORDER BY sentence_id"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("min_id", minId); paramSource.addValue("max_id", maxId); LOG.info(sql);/*from www .ja v a2 s.c o m*/ TreebankDaoImpl.LogParameters(paramSource); List<Integer> sentenceIds = jt.queryForList(sql, paramSource, Integer.class); return sentenceIds; }
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
@SuppressWarnings("unchecked") public List<Integer> findWordIds(int minId, int maxId) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT word_id FROM ftb_word" + " WHERE word_id >= :min_id" + " AND word_id <= :max_id" + " ORDER BY word_id"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("min_id", minId); paramSource.addValue("max_id", maxId); LOG.info(sql);/* w ww. ja v a 2s . c o m*/ TreebankDaoImpl.LogParameters(paramSource); List<Integer> sentenceIds = jt.queryForList(sql, paramSource, Integer.class); return sentenceIds; }
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
public Category loadCategory(int categoryId) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_CATEGORY + " FROM ftb_category WHERE cat_id=:cat_id"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("cat_id", categoryId); LOG.info(sql);/*from www . j a v a2s. c o m*/ TreebankDaoImpl.LogParameters(paramSource); Category category = null; try { category = (Category) jt.queryForObject(sql, paramSource, new CategoryMapper()); } catch (EmptyResultDataAccessException ex) { ex.hashCode(); } return category; }
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
public Category loadCategory(String categoryCode) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_CATEGORY + " FROM ftb_category WHERE cat_code=:cat_code"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("cat_code", categoryCode); LOG.info(sql);//from w w w . ja va2 s .c om TreebankDaoImpl.LogParameters(paramSource); Category category = null; try { category = (Category) jt.queryForObject(sql, paramSource, new CategoryMapper()); } catch (EmptyResultDataAccessException ex) { ex.hashCode(); } return category; }
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
public Function loadFunction(String functionCode) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_FUNCTION + " FROM ftb_function WHERE function_code=:function_code"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("function_code", functionCode); LOG.info(sql);/* w w w .java 2 s . c om*/ TreebankDaoImpl.LogParameters(paramSource); Function function = null; try { function = (Function) jt.queryForObject(sql, paramSource, new FunctionMapper()); } catch (EmptyResultDataAccessException ex) { ex.hashCode(); } return function; }
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
public Morphology loadMorphology(int morphologyId) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_MORPHOLOGY + " FROM ftb_morph WHERE morph_id=:morph_id"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("morph_id", morphologyId); LOG.info(sql);// ww w . j a va 2 s . c o m TreebankDaoImpl.LogParameters(paramSource); Morphology morphology = null; try { morphology = (Morphology) jt.queryForObject(sql, paramSource, new MorphologyMapper()); } catch (EmptyResultDataAccessException ex) { ex.hashCode(); } return morphology; }
From source file:com.joliciel.frenchTreebank.TreebankDaoImpl.java
public Morphology loadMorphology(String morphologyCode) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_MORPHOLOGY + " FROM ftb_morph WHERE morph_code=:morph_code"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("morph_code", morphologyCode); LOG.info(sql);/*from w w w .j av a2 s. c o m*/ TreebankDaoImpl.LogParameters(paramSource); Morphology morphology = null; try { morphology = (Morphology) jt.queryForObject(sql, paramSource, new MorphologyMapper()); } catch (EmptyResultDataAccessException ex) { ex.hashCode(); } return morphology; }