List of usage examples for java.sql ResultSet getBoolean
boolean getBoolean(String columnLabel) throws SQLException;
ResultSet
object as a boolean
in the Java programming language. From source file:com.autentia.tnt.manager.security.AuthenticationManager.java
/** * <p>/* ww w . jav a 2 s . c o m*/ * Get user details given her login. This method accesses tables using JDBC. * Thus, is should only be used if we need to log into the single-user * console to migrate tables (in that case, we cannot rely on Hibernate to * get the users until we have really finished migrating tables and data). * </p> * * @return a MiniUser object (minimal representation of a user) * @param login * user login * @throws com.autentia.tnt.dao.DataNotFoundException * if user does not exist * @throws com.autentia.tnt.dao.DataIntegrityException * if user is duplicated in DB * @throws com.autentia.tnt.dao.DataAccException * if something fails accessing DB */ private Principal jdbcSearchByLogin(String login) throws DataAccException, DataNotFoundException, DataIntegrityException { Session ses = HibernateUtil.getSessionFactory().openSession(); Connection con = ses.connection(); Principal ret; try { PreparedStatement stmt = null; ResultSet rs = null; try { stmt = con.prepareStatement("select u.id,u.login,u.password,u.active,u.name,r.id roleId " + "from User u,Role r " + "where u.roleId=r.id " + "and u.login=?"); stmt.setString(1, login); rs = stmt.executeQuery(); if (rs.next()) { int roleId = rs.getInt("roleId"); ret = new Principal(rs.getInt("id"), 0, // In console mode we won't need departmentId so // we leave it blank. We can't get // it from the database because in versions prior to // 0.4 the field didn't exist rs.getString("login"), rs.getString("password"), rs.getBoolean("active"), rs.getString("name"), roleId, (roleId == administratorRoleId) ? new GrantedAuthority[] { Permission.Action_Console } : new GrantedAuthority[] {}); if (rs.next()) { throw new DataIntegrityException(User.class, "Duplicated user login: " + login); } } else { throw new DataNotFoundException(User.class, login); } } catch (SQLException e) { throw new DataAccException("Error loading user: " + login, e); } finally { if (rs != null) try { rs.close(); } catch (SQLException e) { log.error("jdbcSearchByLogin - Error al liberar el resultset", e); } ; if (stmt != null) try { stmt.close(); } catch (SQLException e) { log.error("jdbcSearchByLogin - Error al liberar el statement", e); } ; } } finally { ses.close(); } return ret; }
From source file:eionet.meta.dao.mysql.SchemaSetDAOImpl.java
/** * @see eionet.meta.dao.ISchemaSetDAO#getSchemaSets(String) *//*from w w w . j a v a 2 s . c o m*/ @Override public List<SchemaSet> getSchemaSets(String userName) { // Get the ID of 'Name' attribute beforehand. int nameAttrId = getJdbcTemplate() .queryForInt("select M_ATTRIBUTE_ID from M_ATTRIBUTE where SHORT_NAME='Name'"); // Now build the main sql, joining to ATTRIBUTE table via above-found ID of 'Name'. StringBuilder sql = new StringBuilder() .append("select SCHEMA_SET_ID, IDENTIFIER, CONTINUITY_ID, REG_STATUS, WORKING_COPY, ") .append("WORKING_USER, DATE_MODIFIED, USER_MODIFIED, COMMENT, CHECKEDOUT_COPY_ID, STATUS_MODIFIED "); if (nameAttrId > 0) { sql.append(",ATTRIBUTE.VALUE as NAME "); } sql.append("from T_SCHEMA_SET "); Map<String, Object> params = new HashMap<String, Object>(); if (nameAttrId > 0) { sql.append("left outer join ATTRIBUTE on ").append( "(T_SCHEMA_SET.SCHEMA_SET_ID=ATTRIBUTE.DATAELEM_ID and ATTRIBUTE.PARENT_TYPE=:attrParentType ") .append("and ATTRIBUTE.M_ATTRIBUTE_ID=:nameAttrId) "); params.put("attrParentType", DElemAttribute.ParentType.SCHEMA_SET.toString()); params.put("nameAttrId", nameAttrId); } sql.append("where "); if (StringUtils.isBlank(userName)) { sql.append("WORKING_COPY=FALSE "); // sql.append("(WORKING_COPY=FALSE and REG_STATUS = :regStatus) "); // params.put("regStatus", SchemaSet.RegStatus.RELEASED.toString()); } else { sql.append("(WORKING_COPY=FALSE or WORKING_USER=:workingUser) "); params.put("workingUser", userName); } // Working copy is added to "order by" so that a working copy always comes after the original when the result list is // displeyd to the user. sql.append("order by ifnull(NAME,IDENTIFIER), SCHEMA_SET_ID"); // Execute the main SQL, build result list. List<SchemaSet> items = getNamedParameterJdbcTemplate().query(sql.toString(), params, new RowMapper<SchemaSet>() { @Override public SchemaSet mapRow(ResultSet rs, int rowNum) throws SQLException { SchemaSet ss = new SchemaSet(); ss.setId(rs.getInt("SCHEMA_SET_ID")); ss.setIdentifier(rs.getString("IDENTIFIER")); ss.setContinuityId(rs.getString("CONTINUITY_ID")); ss.setRegStatus(RegStatus.fromString(rs.getString("REG_STATUS"))); ss.setWorkingCopy(rs.getBoolean("WORKING_COPY")); ss.setWorkingUser(rs.getString("WORKING_USER")); ss.setDateModified(rs.getTimestamp("DATE_MODIFIED")); ss.setUserModified(rs.getString("USER_MODIFIED")); ss.setComment(rs.getString("COMMENT")); ss.setCheckedOutCopyId(rs.getInt("CHECKEDOUT_COPY_ID")); String name = rs.getString("NAME"); if (StringUtils.isNotBlank(name)) { ss.setAttributeValues( Collections.singletonMap("Name", Collections.singletonList(name))); } ss.setStatusModified(rs.getTimestamp("STATUS_MODIFIED")); return ss; } }); return items; }
From source file:com.sfs.whichdoctor.dao.IsbEntityDAOImpl.java
/** * Load isb entity.//from w w w.j a v a2 s .c om * * @param rs the rs * * @return the isb entity bean * * @throws SQLException the SQL exception */ private IsbEntityBean loadIsbEntity(final ResultSet rs) throws SQLException { IsbEntityBean entity = new IsbEntityBean(); entity.setId(rs.getInt("Id")); entity.setGUID(rs.getInt("GUID")); entity.setIdentifier(rs.getString("Identifier")); entity.setName(rs.getString("Name")); entity.setTarget(rs.getString("Target")); entity.setObjectType(rs.getString("ObjectType")); entity.setActive(rs.getBoolean("Active")); try { entity.setCreatedDate(rs.getTimestamp("CreatedInternal")); } catch (SQLException e) { dataLogger.debug("Error reading CreatedInternal date: " + e.getMessage()); } try { entity.setModifiedDate(rs.getTimestamp("ModifiedInternal")); } catch (SQLException e) { dataLogger.debug("Error reading ModifiedInternal date: " + e.getMessage()); } try { entity.setExportedDate(rs.getTimestamp("ModifiedExternal")); } catch (SQLException e) { dataLogger.debug("Error reading ModifiedExternal date: " + e.getMessage()); } return entity; }
From source file:com.act.lcms.db.model.MS1ScanForWellAndMassCharge.java
@Override protected List<MS1ScanForWellAndMassCharge> fromResultSet(ResultSet resultSet) throws SQLException, IOException, ClassNotFoundException { List<MS1ScanForWellAndMassCharge> results = new ArrayList<>(); while (resultSet.next()) { Integer id = resultSet.getInt(DB_FIELD.ID.getOffset()); Integer plateId = resultSet.getInt(DB_FIELD.PLATE_ID.getOffset()); Integer plateRow = resultSet.getInt(DB_FIELD.PLATE_ROW.getOffset()); Integer plateColumn = resultSet.getInt(DB_FIELD.PLATE_COLUMN.getOffset()); Double maxYAxis = resultSet.getDouble(DB_FIELD.MAX_Y_AXIS.getOffset()); Boolean useSNR = resultSet.getBoolean(DB_FIELD.USE_SNR.getOffset()); String lcmsScanFilePath = resultSet.getString(DB_FIELD.SCAN_FILE.getOffset()); String chemicalName = resultSet.getString(DB_FIELD.CHEMICAL_NAME.getOffset()); List<String> metlinIons = MS1ScanForWellAndMassCharge .deserializeMetlinIons(resultSet.getString(DB_FIELD.METLIN_IONS.getOffset())); Map<String, List<XZ>> ionsToSpectra = MS1ScanForWellAndMassCharge .deserialize(resultSet.getBytes(DB_FIELD.IONS_TO_SPECTRA.getOffset())); Map<String, Double> ionsToIntegral = MS1ScanForWellAndMassCharge .deserialize(resultSet.getBytes(DB_FIELD.IONS_TO_INTEGRAL.getOffset())); Map<String, Double> ionsToMax = MS1ScanForWellAndMassCharge .deserialize(resultSet.getBytes(DB_FIELD.IONS_TO_MAX.getOffset())); Map<String, Double> ionsToLogSNR = MS1ScanForWellAndMassCharge .deserialize(resultSet.getBytes(DB_FIELD.IONS_TO_LOG_SNR.getOffset())); Map<String, Double> ionsToAvgSignal = MS1ScanForWellAndMassCharge .deserialize(resultSet.getBytes(DB_FIELD.IONS_TO_AVG_SIGNAL.getOffset())); Map<String, Double> ionsToAvgAmbient = MS1ScanForWellAndMassCharge .deserialize(resultSet.getBytes(DB_FIELD.IONS_TO_AVG_AMBIENT.getOffset())); Map<String, Double> individualMaxIntensities = MS1ScanForWellAndMassCharge .deserialize(resultSet.getBytes(DB_FIELD.INDIVIDUAL_MAX_INTENSITIES.getOffset())); results.add(new MS1ScanForWellAndMassCharge(id, plateId, plateColumn, plateRow, useSNR, lcmsScanFilePath, chemicalName, metlinIons, ionsToSpectra, ionsToIntegral, ionsToMax, ionsToLogSNR, ionsToAvgSignal, ionsToAvgAmbient, individualMaxIntensities, maxYAxis)); }/*from w ww .j ava2 s. c o m*/ return results; }
From source file:com.jjtree.servelet.Articles.java
/** * Handles the HTTP <code>GET</code> method. * * @param request servlet request//w w w . ja v a 2s . c om * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); // one single article String pathInfo = request.getPathInfo(); int singleArticleID = -1; if (pathInfo != null) { String[] path = pathInfo.split("/"); singleArticleID = Integer.parseInt(path[1]); } // mutiple articles String category = request.getParameter("category"); int pageSize = 0; int pageIndex = 0; if (category != null) { pageSize = Integer.parseInt(request.getParameter("pageSize")); pageIndex = Integer.parseInt(request.getParameter("pageIndex")); } // search articles String query = request.getParameter("q"); if (query != null) { pageSize = Integer.parseInt(request.getParameter("pageSize")); pageIndex = Integer.parseInt(request.getParameter("pageIndex")); } try { // Register JDBC driver Class.forName(JConstant.JDBC_DRIVER); // Open a connection conn = DriverManager.getConnection(JConstant.DB_URL, JConstant.USER, JConstant.PASSWORD); // Execute SQL query stmt = conn.createStatement(); String sql = null; if (singleArticleID >= 0) { sql = "SELECT * FROM JArticle WHERE articleID = " + singleArticleID; } if (category != null) { if (category.equalsIgnoreCase(TOP)) { sql = "SELECT * FROM JArticle ORDER BY usefulValue DESC OFFSET " + pageSize * pageIndex + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY"; } if (category.equalsIgnoreCase(RECENT)) { sql = "SELECT * FROM JArticle ORDER BY createdAt DESC OFFSET " + pageSize * pageIndex + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY"; } // collection if (category.equalsIgnoreCase(COLLECTION) || category.equalsIgnoreCase(EDIT) || category.equalsIgnoreCase(REWARD) || category.equalsIgnoreCase(USEFUL) || category.equalsIgnoreCase(USELESS) || category.equalsIgnoreCase(SHARE)) { sql = getSqlQuery(category, request, pageSize, pageIndex); } } if (query != null) { sql = "SELECT * FROM JArticle WHERE title IN ( SELECT title FROM JArticle WHERE UPPER(title) LIKE UPPER('%" + query + "%') ORDER BY createdAt DESC ) OFFSET " + (pageIndex * pageSize) + " ROWS FETCH NEXT " + pageSize + " ROWS ONLY"; } ResultSet rs = stmt.executeQuery(sql); JSONObject articlesObject = new JSONObject(); JSONArray articles = new JSONArray(); JSONArray paragraphs = new JSONArray(); // Extract data from result set while (rs.next()) { //Retrieve by column name int articleID = rs.getInt("articleID"); int authorID = rs.getInt("userID"); boolean isPrivate = rs.getBoolean("isPrivate"); String title = rs.getString("title"); Timestamp createdAt = rs.getTimestamp("createdAt"); Timestamp updatedAt = rs.getTimestamp("updatedAt"); int usefulValue = rs.getInt("usefulValue"); int uselessValue = rs.getInt("uselessValue"); int viewCount = rs.getInt("viewCount"); String accountUrl = "/accounts/" + authorID; JSONObject author = JServeletManager.fetchFrom(request, accountUrl); JSONObject article = new JSONObject(); Statement subStatement = conn.createStatement(); String subSql = "SELECT * FROM JParagraph WHERE articleID = " + articleID; ResultSet subRs = subStatement.executeQuery(subSql); while (subRs.next()) { int paragraphID = subRs.getInt("paragraphID"); int position = subRs.getInt("position"); String type = subRs.getString("type"); String content = subRs.getString("content"); JSONObject paragraph = new JSONObject(); paragraph.put("paragraphID", paragraphID); paragraph.put("position", position); paragraph.put("type", type); paragraph.put("content", content); paragraphs.put(paragraph); } article.put("articleID", articleID); article.put("authorID", authorID); article.put("isPrivate", isPrivate); article.put("title", title); article.put("createdAt", createdAt); article.put("updatedAt", updatedAt); article.put("usefulValue", usefulValue); article.put("uselessValue", uselessValue); article.put("viewCount", viewCount); article.put("paragraphs", paragraphs); article.put("author", author); PrintWriter writer = response.getWriter(); // single article if (singleArticleID >= 0) { writer.print(article); writer.flush(); } if (category != null || query != null) { articles.put(article); } } if (category != null || query != null) { articlesObject.put("articles", articles); PrintWriter writer = response.getWriter(); writer.print(articlesObject); writer.flush(); } // Clean-up environment rs.close(); stmt.close(); conn.close(); } catch (SQLException se) { //Handle errors for JDBC se.printStackTrace(); } catch (Exception e) { //Handle errors for Class.forName e.printStackTrace(); } finally { //finally block used to close resources try { if (stmt != null) { stmt.close(); } } catch (SQLException se2) { } // nothing we can do try { if (conn != null) { conn.close(); } } catch (SQLException se) { se.printStackTrace(); } //end finally try } //end try }
From source file:com.sfs.whichdoctor.dao.BulkEmailDAOImpl.java
/** * Load bulk email.//from w ww. j av a 2 s. co m * * @param rs the rs * @param loadDetails the load details * @return the bulk email bean * @throws SQLException the sQL exception */ private BulkEmailBean loadBulkEmail(final ResultSet rs, final BuilderBean loadDetails) throws SQLException { BulkEmailBean bulkEmail = new BulkEmailBean(); bulkEmail.setId(rs.getInt("BulkEmailId")); bulkEmail.setGUID(rs.getInt("GUID")); bulkEmail.setEmailAddress(rs.getString("EmailAddress")); bulkEmail.setSenderName(rs.getString("SenderName")); bulkEmail.setAdditionalRecipients(rs.getString("AdditionalRecipients")); bulkEmail.setSubject(rs.getString("Subject")); bulkEmail.setPriority(rs.getInt("Priority")); bulkEmail.setAppendContact(rs.getBoolean("AppendContact")); bulkEmail.setAppendLogo(rs.getBoolean("AppendLogo")); bulkEmail.setAppendPrivacy(rs.getBoolean("AppendPrivacy")); bulkEmail.setDeliverOutOfHours(rs.getBoolean("DeliverOutOfHours")); bulkEmail.setMessage(rs.getString("Message")); bulkEmail.setEmailClass(rs.getString("EmailClass")); bulkEmail.setEmailType(rs.getString("EmailType")); bulkEmail.setSentCount(rs.getInt("SentCount")); bulkEmail.setFailedCount(rs.getInt("FailedCount")); bulkEmail.setPendingCount(rs.getInt("PendingCount")); bulkEmail.setActive(rs.getBoolean("Active")); try { bulkEmail.setCreatedDate(rs.getTimestamp("CreatedDate")); } catch (SQLException sqe) { dataLogger.debug("Error reading CreatedDate: " + sqe.getMessage()); } bulkEmail.setCreatedBy(rs.getString("CreatedBy")); try { bulkEmail.setModifiedDate(rs.getTimestamp("ModifiedDate")); } catch (SQLException sqe) { dataLogger.debug("Error reading ModifiedDate: " + sqe.getMessage()); } bulkEmail.setModifiedBy(rs.getString("ModifiedBy")); // Load user details from DB UserBean user = new UserBean(); user.setDN(rs.getString("CreatedBy")); user.setPreferredName(rs.getString("CreatedFirstName")); user.setLastName(rs.getString("CreatedLastName")); bulkEmail.setCreatedUser(user); UserBean modified = new UserBean(); modified.setDN(rs.getString("ModifiedBy")); modified.setPreferredName(rs.getString("ModifiedFirstName")); modified.setLastName(rs.getString("ModifiedLastName")); bulkEmail.setModifiedUser(modified); if (loadDetails.getBoolean("EMAIL_RECIPIENTS")) { try { bulkEmail.setEmailRecipients(this.emailRecipientDAO.load(bulkEmail.getGUID())); } catch (Exception e) { dataLogger.error("Error loading email recipients: " + e.getMessage()); } } return bulkEmail; }
From source file:com.cnd.greencube.server.dao.jdbc.JdbcDAO.java
@SuppressWarnings("rawtypes") private Object getColumnValue(ResultSet rs, ResultSetMetaData meta, int index, Class clazz) throws Exception { Object value = null;//ww w .jav a 2s . c o m int type = meta.getColumnType(index); if (clazz == String.class) { value = rs.getString(index); } else if (clazz == Integer.class) { value = rs.getInt(index); } else if (clazz == Boolean.class) { value = rs.getBoolean(index); } else if (clazz == byte[].class) { if (type == Types.BLOB) value = rs.getBlob(index); else value = rs.getBytes(index); } else if (clazz == Long.class) { value = rs.getLong(index); } else if (clazz == BigInteger.class) { value = rs.getBigDecimal(index); } else if (clazz == Float.class) { value = rs.getFloat(index); } else if (clazz == Double.class) { value = rs.getDouble(index); } else if (clazz == java.util.Date.class) { Timestamp time = rs.getTimestamp(index); if (time == null) value = null; else { value = new java.util.Date(time.getTime()); } } else if (clazz == java.sql.Date.class) { value = rs.getDate(index); } else if (clazz == java.sql.Time.class) { value = rs.getTime(index); } else if (clazz == java.sql.Timestamp.class) { value = rs.getTimestamp(index); } else { throw new Exception("Cannote determin this column type:" + meta.getColumnName(index)); } return value; }
From source file:com.manydesigns.portofino.model.database.ConnectionProvider.java
protected void readType(ResultSet typeRs) throws SQLException { String typeName = typeRs.getString("TYPE_NAME"); int dataType = typeRs.getInt("DATA_TYPE"); Integer maximumPrecision;/* www .ja va 2 s. c om*/ Object maximumPrecisionObj = typeRs.getObject("PRECISION"); if (maximumPrecisionObj instanceof Number) { maximumPrecision = ((Number) maximumPrecisionObj).intValue(); } else { maximumPrecision = null; logger.warn("Cannot get maximum precision for type: {} value: {}", typeName, maximumPrecisionObj); } String literalPrefix = typeRs.getString("LITERAL_PREFIX"); String literalSuffix = typeRs.getString("LITERAL_SUFFIX"); boolean nullable = (typeRs.getShort("NULLABLE") == DatabaseMetaData.typeNullable); boolean caseSensitive = typeRs.getBoolean("CASE_SENSITIVE"); boolean searchable = (typeRs.getShort("SEARCHABLE") == DatabaseMetaData.typeSearchable); boolean autoincrement = typeRs.getBoolean("AUTO_INCREMENT"); short minimumScale = typeRs.getShort("MINIMUM_SCALE"); short maximumScale = typeRs.getShort("MAXIMUM_SCALE"); Type type = new Type(typeName, dataType, maximumPrecision, literalPrefix, literalSuffix, nullable, caseSensitive, searchable, autoincrement, minimumScale, maximumScale); types.add(type); }
From source file:biz.vnc.helpers.LeadHelper.java
@Override public String listSharedItems(String leadId) { List<SharedItemBean> returnValue = new ArrayList<SharedItemBean>(); String query = "select * from tbl_crm_share where leadId = ?; "; try {// w w w. j a v a 2s. c o m preparedStatement = DBUtility.connection.prepareStatement(query); preparedStatement.setString(1, leadId); } catch (SQLException e) { ZLog.err("VNC CRM for Zimbra", "Error in listSharedItems in LeadHelper", e); } ResultSet rs = dbu.select(preparedStatement); SharedItemBean sharedItemBean = null; try { while (rs.next()) { sharedItemBean = new SharedItemBean(); sharedItemBean.setLeadId(rs.getInt("leadId")); sharedItemBean.setUserId(rs.getString("userId")); sharedItemBean.setWriteAccess(rs.getBoolean("writeAccess")); returnValue.add(sharedItemBean); } } catch (SQLException e) { ZLog.err("VNC CRM for Zimbra", "Error listSharedItems result set in Lead Helper Class", e); } return gson.toJson(returnValue); }
From source file:com.chiorichan.database.DatabaseEngine.java
public static Map<String, Object> convertRow(ResultSet rs) throws SQLException { Map<String, Object> result = Maps.newLinkedHashMap(); ResultSetMetaData rsmd = rs.getMetaData(); int numColumns = rsmd.getColumnCount(); for (int i = 1; i < numColumns + 1; i++) { String columnName = rsmd.getColumnName(i); // Loader.getLogger().info( "Column: " + columnName + " <-> " + rsmd.getColumnTypeName( i ) ); if (rsmd.getColumnType(i) == java.sql.Types.ARRAY) { result.put(columnName, rs.getArray(columnName)); } else if (rsmd.getColumnType(i) == java.sql.Types.BIGINT) { result.put(columnName, rs.getInt(columnName)); } else if (rsmd.getColumnType(i) == java.sql.Types.TINYINT) { result.put(columnName, rs.getInt(columnName)); } else if (rsmd.getColumnType(i) == java.sql.Types.BIT) // Sometimes tinyints are read as bits {//from ww w . j a v a 2s . c om result.put(columnName, rs.getInt(columnName)); } else if (rsmd.getColumnType(i) == java.sql.Types.BOOLEAN) { result.put(columnName, rs.getBoolean(columnName)); } else if (rsmd.getColumnTypeName(i).contains("BLOB") || rsmd.getColumnType(i) == java.sql.Types.BINARY) { // BLOG = Max Length 65,535. Recommended that you use a LONGBLOG. byte[] bytes = rs.getBytes(columnName); result.put(columnName, bytes); /* * try * { * result.put( columnName, new String( bytes, "ISO-8859-1" ) ); * } * catch ( UnsupportedEncodingException e ) * { * e.printStackTrace(); * } */ } else if (rsmd.getColumnType(i) == java.sql.Types.DOUBLE) { result.put(columnName, rs.getDouble(columnName)); } else if (rsmd.getColumnType(i) == java.sql.Types.FLOAT) { result.put(columnName, rs.getFloat(columnName)); } else if (rsmd.getColumnTypeName(i).equals("INT")) { result.put(columnName, rs.getInt(columnName)); } else if (rsmd.getColumnType(i) == java.sql.Types.NVARCHAR) { result.put(columnName, rs.getNString(columnName)); } else if (rsmd.getColumnTypeName(i).equals("VARCHAR")) { result.put(columnName, rs.getString(columnName)); } else if (rsmd.getColumnType(i) == java.sql.Types.SMALLINT) { result.put(columnName, rs.getInt(columnName)); } else if (rsmd.getColumnType(i) == java.sql.Types.DATE) { result.put(columnName, rs.getDate(columnName)); } else if (rsmd.getColumnType(i) == java.sql.Types.TIMESTAMP) { result.put(columnName, rs.getTimestamp(columnName)); } else { result.put(columnName, rs.getObject(columnName)); } } return result; }