Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.ResultSetExtractor


    String query = "SELECT AN01_DSB_SOGGETTO FROM SOGGETTI WHERE AN01_NR_SOGGETTO = ?";
    String result = null;
    Object[] bind = new Object[1];
    bind[0] = Long.valueOf(numeroSoggetto);
    try {
      result = (String) getJdbcTemplate().query(query, bind, new ResultSetExtractor() {
        public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
          String result = null;
          if (rs.next())
            result = rs.getString(1);
          return result;
View Full Code Here


    String query = "SELECT CG13_DSC_BANCA FROM BANCA WHERE CG13_COD_BANCA = ?";
    String result = null;
    Object[] bind = new Object[1];
    bind[0] = Long.valueOf(numeroConto);
    try {
      result = (String) getJdbcTemplate().query(query, bind, new ResultSetExtractor() {
        public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
          String result = null;
          if (rs.next())
            result = rs.getString(1);
          return result;
View Full Code Here

    query += "LGTB002_DT_CHIUSURA is null ";
    Long result = null;
    Object[] bind = new Object[1];
    bind[0] = Long.valueOf(numeroMutuo);
    try {
      result = (Long) getJdbcTemplate().query(query, bind, new ResultSetExtractor() {
        public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
          Long result = null;
          if (rs.next())
            result = rs.getLong(1);
          return result;
View Full Code Here

    query += "LGTB002_DT_CHIUSURA is null ";
    Long result = null;
    Object[] bind = new Object[1];
    bind[0] = Long.valueOf(numeroSoggetto);
    try {
      result = (Long) getJdbcTemplate().query(query, bind, new ResultSetExtractor() {
        public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
          Long result = null;
          if (rs.next())
            result = rs.getLong(1);
          return result;
View Full Code Here

    String query = "SELECT PF04_AZIONE FROM DTFIN_RINNOVO WHERE PF04_NR_RINNOVO = ?";
    Long result = null;
    Object[] bind = new Object[1];
    bind[0] = Long.valueOf(numeroRinnovo);
    try {
      result = (Long) getJdbcTemplate().query(query, bind, new ResultSetExtractor() {
        public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
          Long result = null;
          if (rs.next())
            result = rs.getLong(1);
          return result;
View Full Code Here

  public String getSocietaVeicoloDaTabSocietaVeicolo() throws ImpossibileLeggereSocietaVeicoloDaTabSocietaVeicoloException {
    String query = "SELECT CA43_COD_SOCIETA_VEICOLO FROM TAB_SOCIETA_VEICOLO WHERE CA43_FLG_DEFAULT = 'S'";
    String result = null;
    try {
      result = (String) getJdbcTemplate().query(query, new ResultSetExtractor() {
        public Object extractData(ResultSet rs) throws SQLException, DataAccessException {
          String result = null;
          if (rs.next())
            result = rs.getString(1);
          return result;
View Full Code Here

    }
  }

  @Override
  public List<JobInstance> findJobInstancesByName(String jobName, final int start, final int count) {
    @SuppressWarnings("rawtypes")
    ResultSetExtractor extractor = new ResultSetExtractor() {
      private List<JobInstance> list = new ArrayList<JobInstance>();

      @Override
      public Object extractData(ResultSet rs) throws SQLException,
      DataAccessException {
View Full Code Here

    final int counter[] = new int[1];
    counter[0] = 0;
    final JdbcTemplate jdbc = new JdbcTemplate(getDataSource());
    try {
      String sql = " from t_history_property_delta where old_value like 'org.projectforge.%' or new_value like 'org.projectforge.%'";
      jdbc.query("select id, old_value, new_value, property_type" + sql, new ResultSetExtractor() {
        @Override
        public Object extractData(final ResultSet rs) throws SQLException, DataAccessException
        {
          while (rs.next() == true) {
            final int id = rs.getInt("ID");
            final String oldValue = rs.getString("OLD_VALUE");
            final String newValue = rs.getString("NEW_VALUE");
            final Serializable oldId = getObjectId(oldValue);
            final Serializable newId = getObjectId(newValue);
            final String propertyType = rs.getString("PROPERTY_TYPE");
            final int pos = propertyType.indexOf("_$$_javassist_");
            final String newPropertyType;
            if (pos > 0) {
              newPropertyType = propertyType.substring(0, pos);
            } else {
              newPropertyType = null;
            }
            if (oldId == null && newId == null) {
              continue;
            }
            final StringBuffer buf = new StringBuffer();
            boolean first = true;
            buf.append("update t_history_property_delta set ");
            if (oldId != null) {
              buf.append("OLD_VALUE='").append(oldId).append("'");
              first = false;
            }
            if (newId != null) {
              if (first == false) {
                buf.append(", ");
              } else {
                first = false;
              }
              buf.append("NEW_VALUE='").append(newId).append("'");
            }
            if (newPropertyType != null) {
              if (first == false) {
                buf.append(", ");
              } else {
                first = false;
              }
              buf.append("PROPERTY_TYPE='").append(newPropertyType).append("'");
            }
            buf.append(" where ID=").append(id);
            final String sql = buf.toString();
            log.info(sql);
            jdbc.execute(sql);
            counter[0]++;
          }
          return null;
        }
      });
      int no = jdbc.queryForInt("select count(*)" + sql);
      if (no > 0) {
        log.warn("" + no + " of data base history entries aren't fixed.");
      }
      sql = " from t_history_property_delta where property_type like '%_$$_javassist_%'";
      jdbc.query("select id, property_type" + sql, new ResultSetExtractor() {
        @Override
        public Object extractData(final ResultSet rs) throws SQLException, DataAccessException
        {
          while (rs.next() == true) {
            final int id = rs.getInt("ID");
View Full Code Here

   */
  @SuppressWarnings({ "unchecked", "rawtypes"})
  private PFUserDO loadUser(final JdbcTemplate jdbc, final String sql, final String username, final boolean withSaltString)
      throws SQLException
      {
    final PFUserDO user = (PFUserDO)jdbc.query(sql, new Object[] { username}, new ResultSetExtractor() {
      @Override
      public Object extractData(final ResultSet rs) throws SQLException, DataAccessException
      {
        if (rs.next() == true) {
          final PFUserDO user = new PFUserDO();
View Full Code Here

    return "select "+columnNames+" from "+tableName+" where "+templateNameColumn+"=?";
  }

  public Reader getReader(Object templateSource, final String encoding) throws IOException {
    final String templateName = (String)templateSource;
    return (Reader)getJdbcTemplate().query(getSql(templateContentColumn),new Object[]{templateName}, new ResultSetExtractor() {
      public Reader extractData(ResultSet rs) throws SQLException,DataAccessException {
        while(rs.next()) {
          try {
            Object obj = rs.getObject(templateContentColumn);
            if(obj instanceof String) {
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.ResultSetExtractor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.