private static void loadFieldsToFeatureType( Connection conn, PostgresqlStoreParameters params, DBFeatureType featureType) throws ReadException { String sql = ""; String columns = params.getFieldsString(); boolean fillTableData; if (params.getSqlSoure() != null) { sql = params.getSqlSoure(); fillTableData = false; } else { sql = "Select " + columns + " from " + params.tableID(); fillTableData = true; } try { Statement stAux = conn.createStatement(); stAux.setFetchSize(1); ResultSet rs = stAux.executeQuery(sql); ResultSetMetaData rsMetadata = rs.getMetaData(); int i; featureType.setTableID(params.tableID()); DBAttributeDescriptor attr; for (i = 1; i <= rsMetadata.getColumnCount(); i++) { attr = getAttributeFromJDBC(featureType, conn, rsMetadata, i); featureType.add(attr); // attr.setOrdinal(i-1); attr.loading(); attr.setCatalogName(params.getDb()); if (fillTableData) { attr.setSchemaName(params.getSchema()); attr.setTableName(params.getTableName()); } attr.stopLoading(); } rs.close(); stAux.close(); } catch (java.sql.SQLException e) { throw new SQLException(sql, "getFeatureType", e); } catch (IsNotAttributeSettingException e) { e.printStackTrace(); } }