Java Code Examples for java.sql.ResultSet.last()

The following are Jave code examples for showing how to use last() of the java.sql.ResultSet class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: zeratul   File: SqlTools.java   View Source Code Vote up 8 votes
private void handleResultSet(List<Map<String, Object>> list, ResultSet resultSet) {
    try {
        if (resultSet != null && resultSet.last()) {
            resultSet.beforeFirst();
            ResultSetMetaData rsmd = resultSet.getMetaData();
            while (resultSet.next()) {
                Map<String, Object> map = Maps.newHashMap();
                for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                    map.put(rsmd.getColumnName(i), resultSet.getString(i));
                }
                list.add(map);
            }
            resultSet.beforeFirst();
            resultSet.close();
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
 
Example 2
Project: uavstack   File: JdbcDriverAdapter.java   View Source Code Vote up 7 votes
/**
 * 解析resultset中的条数
 * 
 * @param resultSet
 * @return
 */
private String sqlResultSetParse(ResultSet rset) {

    try {
        // 只能向前遍历的游标,只能用next()来遍历
        if (rset.getType() == ResultSet.TYPE_FORWARD_ONLY) {
            return "FORWARD_ONLY";
        }
        else {
            // 可以滚动的游标,在用户使用游标之前,直接获取结果集大小,然后游标回到开始的地方(假装游标没有移动过)
            rset.last();
            int row = rset.getRow();
            rset.beforeFirst();
            return row + "";

        }
    }
    catch (SQLException e) {
        return e.toString();
    }
}
 
Example 3
Project: GUI-Sorting-Time-Comparison-using-JavaFx   File: MainController.java   View Source Code Vote up 6 votes
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
	try {
		myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/gui_assignment?autoReconnect=true&useSSL=false", "root", "root");
		stmt = myConn.createStatement();
		
		ResultSet rs = stmt.executeQuery("select Temperature_Reading from temp_values");
		values = new int[rs.last() ? rs.getRow() : 0];
		
		int[] temp = {10000,100000,500000};
		noOfTempReadings = temp;
		
		rs.setFetchDirection(ResultSet.FETCH_REVERSE);
		rs.next();
		int i = values.length-1;
		while (rs.previous()) {
			values[i--] = rs.getInt("Temperature_Reading");
		}
	} catch (SQLException e) {
		e.printStackTrace();
		System.err.println("DATABASE CONNECT ERROR");
		System.exit(1);
	}
	
	System.out.println("No. of entries in database = "+values.length);
	
	ObservableList<String> pivotValues = FXCollections.observableArrayList("n/2","n/4","n/6");
	pivotSelect.setItems(pivotValues);
	pivotSelect.setValue("n/2");
	pivotSelect.setDisable(true);
	
	ObservableList<Integer> baseValues = FXCollections.observableArrayList(2,10,16);
	base.setItems(baseValues);
	base.setValue(10);
	base.setDisable(true);
	
	btnViewGraph.setDisable(true);
}
 
Example 4
Project: sumo   File: DatabaseModel.java   View Source Code Vote up 6 votes
DatabaseModel(ResultSet rs) {
    try {
        this.rs = rs;
        if(rs==null) return; 
        cname = new String[rs.getMetaData().getColumnCount()];
        for (int i = 0; i < cname.length; i++) {
            cname[i] = rs.getMetaData().getColumnName(i+1);
        }
        rs.last();
        nrow=rs.getRow();
    } catch (SQLException ex) {
    	logger.error(ex.getMessage(),ex);
    }
}
 
Example 5
Project: the-vigilantes   File: BaseTestCase.java   View Source Code Vote up 6 votes
protected void assertResultSetLength(ResultSet rset, int len) throws Exception {
    int oldRowPos = rset.getRow();
    rset.last();
    assertEquals("Result set length", len, rset.getRow());
    if (oldRowPos > 0) {
        rset.absolute(oldRowPos);
    } else {
        rset.beforeFirst();
    }
}
 
Example 6
Project: OpenVertretung   File: BaseTestCase.java   View Source Code Vote up 6 votes
protected void assertResultSetLength(ResultSet rset, int len) throws Exception {
    int oldRowPos = rset.getRow();
    rset.last();
    assertEquals("Result set length", len, rset.getRow());
    if (oldRowPos > 0) {
        rset.absolute(oldRowPos);
    } else {
        rset.beforeFirst();
    }
}
 
Example 7
Project: ClassroomFlipkart   File: getUserName.java   View Source Code Vote up 6 votes
public static String[] getUserName(String mailId) {
    String[] name={"",""};

    Connection con = null;
    PreparedStatement stmt = null;
    ResultSet rs = null;

    String query = DBUtils.prepareSelectQuery(" * ",
            "classroomflipkart.userdetail",
            " emailId = '"+mailId+"' ",
            "" );

    try {
        con = DBUtils.getConnection();
        stmt = con.prepareStatement(query);
        rs = stmt.executeQuery();

        rs.last();
        int size = rs.getRow();

        if (size>0){
            rs.beforeFirst();
            rs.next();
            name[0] = rs.getString("name");
            name[1] = rs.getString("certifiedUser");
        }
        else
            name[0] = "";

    } catch (Exception e) {
        name[0] = e.getMessage();
        e.printStackTrace();
    } finally {
        DBUtils.closeAll(rs, stmt, con);
        return name;
    }
}
 
Example 8
Project: AeroStory   File: MaplePacketCreator.java   View Source Code Vote up 6 votes
public static byte[] BBSThreadList(ResultSet rs, int start) throws SQLException {
    final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
    mplew.writeShort(SendOpcode.GUILD_BBS_PACKET.getValue());
    mplew.write(0x06);
    if (!rs.last()) {
        mplew.write(0);
        mplew.writeInt(0);
        mplew.writeInt(0);
        return mplew.getPacket();
    }
    int threadCount = rs.getRow();
    if (rs.getInt("localthreadid") == 0) { //has a notice
        mplew.write(1);
        addThread(mplew, rs);
        threadCount--; //one thread didn't count (because it's a notice)
    } else {
        mplew.write(0);
    }
    if (!rs.absolute(start + 1)) { //seek to the thread before where we start
        rs.first(); //uh, we're trying to start at a place past possible
        start = 0;
    }
    mplew.writeInt(threadCount);
    mplew.writeInt(Math.min(10, threadCount - start));
    for (int i = 0; i < Math.min(10, threadCount - start); i++) {
        addThread(mplew, rs);
        rs.next();
    }
    return mplew.getPacket();
}
 
Example 9
Project: ClassroomFlipkart   File: getCategories.java   View Source Code Vote up 6 votes
public static String[] getCategories() {
    String[] category = {"ongoing"};

    Connection con = null;
    PreparedStatement stmt = null;
    ResultSet rs = null;

    String query = DBUtils.prepareSelectQuery(" * ",
            "classroomflipkart.category",
            "",
            "GROUP BY category");

    try {
        con = DBUtils.getConnection();
        stmt = con.prepareStatement(query);
        rs = stmt.executeQuery();

        rs.last();
        int size = rs.getRow();

        if (size>0){
            rs.beforeFirst();

            int count = 0;
            category = new String[size];

            while (rs.next())
                category[count++] = rs.getString("category");
        }

    } catch (Exception e) {
        category[0] = e.getMessage();
        e.printStackTrace();
    } finally {
        DBUtils.closeAll(rs, stmt, con);
        return category;
    }
}
 
Example 10
Project: ClassroomFlipkart   File: getSubCategories.java   View Source Code Vote up 6 votes
public static String[] getSubCategories(String category) {
    String[] subcategory ={"ongoing"};

    Connection con = null;
    PreparedStatement stmt = null;
    ResultSet rs = null;

    String query = DBUtils.prepareSelectQuery(" subcategory ",
            "classroomflipkart.category",
            " category = '"+category+"' ",
            "" );

    try {
        con = DBUtils.getConnection();
        stmt = con.prepareStatement(query);
        rs = stmt.executeQuery();

        rs.last();
        int size = rs.getRow();

        if (size>0){
            rs.beforeFirst();

            int count = 0;
            subcategory = new String[size];

            while (rs.next())
                subcategory[count++] = rs.getString("subcategory");
        }

    } catch (Exception e) {
        subcategory[0] = e.getMessage();
        e.printStackTrace();
    } finally {
        DBUtils.closeAll(rs, stmt, con);
        return subcategory;
    }
}
 
Example 11
Project: GameProject-V1.0Beta   File: MyFavoriteDao.java   View Source Code Vote up 6 votes
/**
 * 
 * @param serverIp
 * @param userServerId
 * @param userId
 * @return
 */
public Boolean isFavoriteExistes(String serverIp, String userServerId, String userId) {
	Connection conn = JdbcHelper.getJdbcHelper().getConnection();
	PreparedStatement ps = null;
	ResultSet rs = null;
	
	try {
		if(null != conn) {
			String sql = "select m.* from myfavorites m where m.USERID=? and m.USERSERVERID=? and m.SERVERIP=?;";
			ps = conn.prepareStatement(sql);
			ps.setString(1, userId);
			ps.setString(2, userServerId);
			ps.setString(3, serverIp);
			
			rs = ps.executeQuery();
			
			if(null == rs)
				return null;
			rs.last();
			System.out.println(rs.getRow());
			if(0 < rs.getRow())
				return true;
			return false;
		}
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		System.out.println("sql state: " + e.getSQLState() +
				" --> " + e.getStackTrace() + "  -->" + e.getMessage());
		return null;
	}
	return null;
}
 
Example 12
Project: sjk   File: AppRankDaoImpl.java   View Source Code Vote up 6 votes
@Override
public List<App> getAppDefultRank(final int typeId, final int top) {
    PreparedStatementCallback<List<App>> cb = new PreparedStatementCallback<List<App>>() {
        @Override
        public List<App> doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
            ps.setInt(1, typeId);
            ps.setInt(2, top);
            ResultSet rs = null;
            try {
                rs = ps.executeQuery();
                if (rs.last()) {
                    int count = rs.getRow();
                    List<App> list = new ArrayList<App>(count);
                    rs.beforeFirst();
                    App app = null;
                    while (rs.next()) {
                        app = appRowMapper.mapRow(rs, rs.getRow());
                        changeOutputImpl.setUrls(app);
                        list.add(app);
                    }
                    return list;
                }

            } catch (Exception e) {
                logger.error("SQL data error:", e);
                return null;
            } finally {
                if (null != rs)
                    rs.close();
            }
            return null;
        }
    };
    return jdbcTemplate.execute(QUERY_APP_DEFAULT_TOP_SQL, cb);
}
 
Example 13
Project: uroborosql   File: AuditLogSqlFilter.java   View Source Code Vote up 6 votes
@Override
public ResultSet doQuery(final SqlContext sqlContext, final PreparedStatement preparedStatement,
		final ResultSet resultSet) {
	// カウント初期値
	int rowCount = -1;
	try {
		// resultSetのカーソル種別を取得
		// 種別「TYPE_FORWARD_ONLY」の場合、beforeFirstメソッドが効かないため除外
		if (resultSet.getType() != ResultSet.TYPE_FORWARD_ONLY) {
			// 件数結果取得
			resultSet.last();
			rowCount = resultSet.getRow();
			resultSet.beforeFirst();
		}
	} catch (SQLException e) {
		// ここでの例外は実処理に影響を及ぼさないよう握りつぶす
	}

	String userName = getParam(sqlContext, USER_NAME_KEY);
	if (userName == null) {
		// ユーザ名が設定されていない時
		userName = DEFAULT_USER_NAME;
	}

	String funcId = getParam(sqlContext, FUNC_ID_KEY);
	if (funcId == null) {
		// 機能IDが設定されていない時
		funcId = DEFAULT_FUNC_ID;
	}

	LOG.debug(ToStringBuilder.reflectionToString(
			new AuditData(userName, funcId, sqlContext.getSqlId(), sqlContext.getSqlName(), sqlContext
					.getExecutableSql(), rowCount), ToStringStyle.JSON_STYLE));

	return resultSet;
}
 
Example 14
Project: ClassroomFlipkart   File: dbLoginCheck.java   View Source Code Vote up 5 votes
public static String[] dbLoginCheck(String emailId, String password) {
    Connection con = null;
    PreparedStatement stmt = null;
    ResultSet rs = null;

    String userID = getMotherboardSN.getMotherboardSN();

    String query = DBUtils.prepareSelectQuery(" * ", "classroomflipkart.userdetail", "( emailId = ? AND password = ? )");

    String updateCurrentUserQuery = DBUtils.prepareInsertQuery("classroomflipkart.currentuser", "id, name, emailId", "?,?,?");

    String[] status = {"ongoing",""};

    try {
        con = DBUtils.getConnection();
        stmt = con.prepareStatement(query);
        stmt.setString(1, emailId);
        stmt.setString(2, password);

        rs = stmt.executeQuery();
        rs.last();
        int size = rs.getRow();
        rs.beforeFirst();

        if (size>0){
            status[0]="success";
            rs.next();
            status[1]=rs.getString("name");

            stmt = con.prepareStatement(updateCurrentUserQuery);
            stmt.setString(1, userID);
            stmt.setString(2, status[1]);
            stmt.setString(3, emailId);
            stmt.executeUpdate();
        }

    } catch (Exception e) {
        e.printStackTrace();
        status[0] = e.getMessage();
    } finally {
        DBUtils.closeAll(rs, stmt, con);
        return status;
    }
}
 
Example 15
Project: sjk   File: AppsDaoImpl.java   View Source Code Vote up 5 votes
@Override
public List<App> findByIds(List<Integer> ids) {
    // Session session = sessions.getCurrentSession();
    // Query query = null;
    // query =
    // session.createQuery("select a.id, a.name, a.downLoadLink, a.logo from App a where id in (:ids)").setParameterList("ids",
    // ids);
    // List<App> list = HibernateHelper.list(query);
    // for (App app : list) {
    // changeOutputImpl.setUrls(app);
    // }
    StringBuilder tmp = new StringBuilder(ids.size() * 6);
    for (Integer id : ids) {
        tmp.append(id).append(',');
    }
    tmp.deleteCharAt(tmp.length() - 1);
    String sql = appsByIds.replace("?", tmp.toString());

    PreparedStatementCallback<List<App>> cb = new PreparedStatementCallback<List<App>>() {
        @Override
        public List<App> doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
            ResultSet rs = null;
            try {
                rs = ps.executeQuery();
                if (rs.last()) {
                    int count = rs.getRow();
                    List<App> list = new ArrayList<App>(count);
                    rs.beforeFirst();
                    App app = null;
                    while (rs.next()) {
                        app = appsRowMapper.mapRow(rs, rs.getRow());
                        changeOutputImpl.setUrls(app);
                        list.add(app);
                    }
                    return list;
                } else {
                    return null;
                }
            } finally {
                if (null != rs) {
                    rs.close();
                }
            }
        }

    };
    return this.jdbcTemplate.execute(sql, cb);
}
 
Example 16
Project: ClassroomFlipkart   File: fetchProducts.java   View Source Code Vote up 5 votes
public static BorderPane productbyType(String type) {

        BorderPane products = new BorderPane();
        products.setPadding(new Insets(10,20,10,20));

        Connection con = null;
        PreparedStatement stmt = null;
        ResultSet rs = null;

        String query = DBUtils.prepareSelectQuery(" * ",
                " classroomflipkart.productdetail AS T ," +
                        " ( "+ DBUtils.prepareSelectQuery("productId",
                                " classroomflipkart.homeproducts ",
                                "type = '"+type+"'")+
                        " ) AS S",
                " T.productId = S.productId ");

        try {
            con = DBUtils.getConnection();
            stmt = con.prepareStatement(query);
            rs = stmt.executeQuery();

            rs.last();
            int size = rs.getRow();

            if (size>0){
                rs.beforeFirst();

                Label title = new Label(type+"");
                title.setFont(Font.font("Open Sans", FontWeight.BOLD,17));
                title.setPadding(new Insets(10));
                title.setAlignment(Pos.CENTER);

                HBox productList = new HBox(20);
                productList.setAlignment(Pos.CENTER);

                while (rs.next()) {
                    String productId = rs.getString("productId");
                    String productName = rs.getString("productName");
                    String newPrice = rs.getString("newPrice");
                    String oldPrice = rs.getString("oldPrice");
                    String category = rs.getString("category");
                    String subcategory = rs.getString("subcategory");
                    String imageName = rs.getString("imageName");
                    String productAvailability = rs.getString("productAvailability");

                    productList.getChildren().add(productDetail.productByType(productId,productName,newPrice,oldPrice,category,subcategory,imageName, productAvailability));
                }

                ScrollPane proScroller = new ScrollPane(productList);
                proScroller.setFitToHeight(true);
                proScroller.setFitToWidth(true);
                proScroller.setPannable(true);
                proScroller.setPadding(new Insets(0,0,30,0));

                StackPane titlePane = new StackPane(title);
                titlePane.setAlignment(Pos.CENTER);

                StackPane productPane = new StackPane(proScroller);
                productPane.setAlignment(Pos.CENTER);

                products.setTop(titlePane);
                products.setCenter(productPane);
            }


        } catch (Exception e) {
            products.setCenter(new Label(e.getMessage()));
            e.printStackTrace();
        } finally {
            DBUtils.closeAll(rs, stmt, con);
            return products;
        }
    }
 
Example 17
Project: TechComparisonProject   File: DatabaseTest.java   View Source Code Vote up 5 votes
public static void load(Statement stmt, Connection con) throws SQLException {
    //initailise variables
    String[][] compArray;
    String test = "*";
    String condition = "";
    
    //Select statement to find variables
    String get = "SELECT " + test + " FROM mydb.languages " + condition;

    //Execute Query on statement
    ResultSet rs = stmt.executeQuery(get);

    int databaseSize = 0;
    int columnNum = 15;

    //find last row
    if (rs.last()) {
        databaseSize = rs.getRow();
        rs.beforeFirst();
    }
    
            
    compArray = new String[databaseSize][columnNum];
    int x = 0;

    while (rs.next()) {
        //Load Array
        compArray[x][0] = rs.getString("ID");
        compArray[x][1] = rs.getString("Name");
        compArray[x][2] = rs.getString("Imperative");
        compArray[x][3] = rs.getString("Object-Oriented");
        compArray[x][4] = rs.getString("Functional");
        compArray[x][5] = rs.getString("Procedural");
        compArray[x][6] = rs.getString("Generic");
        compArray[x][7] = rs.getString("Reflective");
        compArray[x][8] = rs.getString("Event-Driven");
        compArray[x][9] = rs.getString("For Loop");
        compArray[x][10] = rs.getString("While Loop");
        compArray[x][11] = rs.getString("Arrays");
        compArray[x][12] = rs.getString("Operators");
        compArray[x][13] = rs.getString("Uses");
        compArray[x][14] = rs.getString("Paradigms");
        x++;
    }
    
    //create percentages 
    create(compArray, con);
    
    //call Compare
    compare(compArray, con);
}
 
Example 18
Project: kibana_sourceforge   File: Load_Data.java   View Source Code Vote up 5 votes
public static void main(String[] args) throws IOException {
    try {
        int max = 1000000;
        Connection connection = DriverManager.getConnection("jdbc:mysql://flossdata.syr.edu:3306", "username", "password");
        // Creates file
        BufferedWriter buffW = new BufferedWriter(Create_file());
        Statement stmt = (Statement) connection.createStatement();

        // Get projects from 2005
        String sql = "SELECT DISTINCT proj_unixname FROM sourceforge.sf_project_status";
        sql += " WHERE date_collected > '2005-01-01' "
                + "AND date_collected < '2005-12-12' "
                + "AND description != 'Inactive' LIMIT 10000;";
        ResultSet projectname = stmt.executeQuery(sql);
        System.out.println("Created project list!");

        if (projectname != null) {
            // Get number of projects
            projectname.last();
            int count = projectname.getRow();
            // Set project list to first position
            projectname.beforeFirst();
            int projectcount = 0;
            // Runs through all projects
            while (projectname.next()) {
                projectcount++;
                if (projectcount==2000)
                    break;
                System.out.println("Skip " + projectcount + " out of " + count);
            }

            while (projectname.next()) {
                projectcount++;
                System.out.println("Processing project " + projectcount + " out of " + count);
                projectname.getString(1);

                // Writes project details in file
                buffW.newLine();
                buffW.write("{\"index\":{\"_index\":\"projects\", \"_type\":\"project\", \"_id\": \"" + projectcount + "\"}}");
                buffW.newLine();
                buffW.write(read_attr(projectname.getString(1), connection));buffW.newLine();

                //Breaks if max is reached
                if (projectcount==max)
                    break;
            }
        }
        //Closes all connections
        buffW.close();
        stmt.close();
        connection.close();
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}
 
Example 19
Project: mongodb-rdbms-sync   File: O2MEventDistributorNew.java   View Source Code Vote up 5 votes
private RowId createSubEvents(final String query, RowId rid, String tableName, boolean isChildQuery) throws SyncError {
	logger.info("createSubEvents called with parameters : isChildQuery =" + isChildQuery + " , rid = " + rid
			+ " , tableName = " + tableName + " , query = " + query);
	PreparedStatement rowIdpstmt = null;
	ResultSet rowIdSet = null;
	RowId maxRid = null;
	RowId minRid = null;
	try {
		rowIdpstmt = connection.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE,
				ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
		if (isChildQuery) {
			rowIdpstmt.setRowId(1, rid);
		}
		rowIdpstmt.setFetchSize(5000);
		rowIdSet = rowIdpstmt.executeQuery();
		rowIdSet.next();
		minRid = rowIdSet.getRowId(1);
		for (++subEventCount; subEventCount < (degree - 1); subEventCount++) {
			rowIdSet.relative((int) optimalRange);
			maxRid = rowIdSet.getRowId(1);
			getSubEvent(minRid, maxRid, false);
			minRid = maxRid;
			fetchCount += optimalRange;
			if (fetchCount > 1000000L) {
				break;
			}
		}
		if (subEventCount == (degree - 1)) {
			rowIdSet.last();
			maxRid = rowIdSet.getRowId(1);
			getSubEvent(minRid, maxRid, true);
			logger.info("Total subEvents created :" + eventCount);
		}
	} catch (Exception e) {
		logger.error("Error while creating subEvents ", e);
		throw new SyncError(e);
	} finally {
		DbResourceUtils.closeResources(rowIdSet, rowIdpstmt, null);
	}
	return maxRid;
}
 
Example 20
Project: mongodb-rdbms-sync   File: O2MEventDistributor.java   View Source Code Vote up 5 votes
private RowId createSubEvents(String query, RowId rid, String tableName, boolean isChildQuery) throws SyncError{
	logger.info("createSubEvents called with parameters : isChildQuery =" + isChildQuery + " , rid = " + rid
			+ " , tableName = " + tableName + " , query = " + query);
	PreparedStatement rowIdpstmt = null;
	ResultSet rowIdSet = null;
	RowId maxRid = null;
	RowId minRid = null;
	try {
		rowIdpstmt = connection.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE,
				ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
		if (isChildQuery) {
			rowIdpstmt.setRowId(1, rid);
		}
		rowIdpstmt.setFetchSize(5000);
		rowIdSet = rowIdpstmt.executeQuery();
		rowIdSet.next();
		minRid = rowIdSet.getRowId(1);
		for (++subEventCount;subEventCount < (degree - 1); subEventCount++) {
			rowIdSet.relative((int) optimalRange);
			maxRid = rowIdSet.getRowId(1);
			getSubEvent(minRid, maxRid, false);
			minRid = maxRid;
			fetchCount += optimalRange;
			if (fetchCount > 1000000L) {
				break;
			}
		}
		if (subEventCount == (degree - 1)) {
			rowIdSet.last();
			maxRid = rowIdSet.getRowId(1);
			getSubEvent(minRid, maxRid, true);
			logger.info("Total subEvents created :" + eventCount);
		}
	} catch (Exception e) {
		logger.error("Error while creating subEvents ", e);
		throw new SyncError(e);
	} finally {
		DbResourceUtils.closeResources(rowIdSet, rowIdpstmt, null);
	}
	return maxRid;
}