    public boolean findByPrimaryKey(Connection con, Integer id)
            throws java.sql.SQLException, ObjectNotFoundException {
        boolean found = false;
        StringBuffer sql = new StringBuffer();
        sql.append("SELECT * ");
        sql.append("FROM ");
        sql.append("[" + DATABASE_TABLE_NAME + "] ");
        sql.append("WHERE [AssetAllocationID] = ? ");
        try (PreparedStatement pstmt = con.prepareStatement(sql.toString());) {
            pstmt.setInt(1, id.intValue());
            ResultSet rs = pstmt.executeQuery();
            // do we have any result?
            if (rs.next()) {
                found = true;
                // get the data
                assetAllocation.setAssetAllocationID(rs.getInt("AssetAllocationID"));
                assetAllocation.setAmount(rs.getDouble("Amount"));
                assetAllocation.setInCash(rs.getDouble("InCash"));
                assetAllocation.setInFixedInterest(rs.getDouble("InFixedInterest"));
                assetAllocation.setInAustShares(rs.getDouble("InAustShares"));
                assetAllocation.setInIntnlShares(rs.getDouble("InIntnlShares"));
                assetAllocation.setInProperty(rs.getDouble("InProperty"));
                assetAllocation.setInOther(rs.getDouble("InOther"));
                assetAllocation.setInclude(rs.getString("Include") != null);
            } else {
                throw new ObjectNotFoundException("Can not find Asset Allocation ID: " + id);
            }
            rs.close();
        }
        return found;
    }

    public boolean findByPrimaryKey(Connection con, Integer id)
            throws java.sql.SQLException, ObjectNotFoundException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [AssetAllocationID] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, id.intValue());

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                found = true;
                // get the data
                assetAllocation.setAssetAllocationID(new Integer(rs
                        .getInt("AssetAllocationID")));
                assetAllocation.setAmount(new Double(rs.getDouble("Amount")));
                assetAllocation.setInCash(new Double(rs.getDouble("InCash")));
                assetAllocation.setInFixedInterest(new Double(rs
                        .getDouble("InFixedInterest")));
                assetAllocation.setInAustShares(new Double(rs
                        .getDouble("InAustShares")));
                assetAllocation.setInIntnlShares(new Double(rs
                        .getDouble("InIntnlShares")));
                assetAllocation.setInProperty(new Double(rs
                        .getDouble("InProperty")));
                assetAllocation.setInOther(new Double(rs.getDouble("InOther")));
                assetAllocation.setInclude(new Boolean(((rs
                        .getString("Include") == null) ? false : true)));
            } else {
                throw new ObjectNotFoundException(
                        "Can not find Asset Allocation ID: " + id);
            }

        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return found;
    }

Try With Resources try(PreparedStatement pstmt=con.prepareStatement(sql.toString())) in method public findByPrimaryKey(con Connection, id Integer) : boolean from class au.com.totemsoft.myplanner.bean.db.AssetAllocationBean


    /**
     * Creates a new entry in the "apir_pic" table. The properties for the new
     * entry must be set before creating a new entry.
     */
    public void create() throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer
                    .append("(identifier, [apir_pic], [apir_full_name], [apir_short_name], [apir_brief_name], code, id) ");
            pstmt_StringBuffer.append("VALUES ( ?, ?, ?, ?, ?, ?, ? )");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.identifier);
            pstmt.setString(2, this.apir_pic);
            pstmt.setString(3, this.apir_full_name);
            pstmt.setString(4, this.apir_short_name);
            pstmt.setString(5, this.apir_brief_name);
            pstmt.setInt(6, this.code);
            // pstmt.setTimestamp ( 7, this.id_old );
            pstmt.setInt(7, this.id);

            status = pstmt.executeUpdate();
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }
    }

    /**
     * Creates a new entry in the "apir_pic" table. The properties for the new
     * entry must be set before creating a new entry.
     */
    public void create() throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer
                    .append("(identifier, [apir_pic], [apir_full_name], [apir_short_name], [apir_brief_name], code, id) ");
            pstmt_StringBuffer.append("VALUES ( ?, ?, ?, ?, ?, ?, ? )");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.identifier);
            pstmt.setString(2, this.apir_pic);
            pstmt.setString(3, this.apir_full_name);
            pstmt.setString(4, this.apir_short_name);
            pstmt.setString(5, this.apir_brief_name);
            pstmt.setInt(6, this.code);
            // pstmt.setTimestamp ( 7, this.id_old );
            pstmt.setInt(7, this.id);

            status = pstmt.executeUpdate();

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public create() : void from class au.com.totemsoft.myplanner.bean.db.ApirPicBean


    /**
     * Stores an entry in the "apir_pic" table. The properties for the entry
     * must be set before storing it.
     */
    public void store() throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("UPDATE ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("SET ");
            pstmt_StringBuffer.append("identifier = ?, ");
            pstmt_StringBuffer.append("[apir_full_name] = ?, ");
            pstmt_StringBuffer.append("[apir_short_name] = ?, ");
            pstmt_StringBuffer.append("[apir_brief_name] = ?, ");
            pstmt_StringBuffer.append("code = ?,  ");
            pstmt_StringBuffer.append("id = ? ");
            pstmt_StringBuffer.append("WHERE [apir_pic] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.identifier);
            pstmt.setString(2, this.apir_full_name);
            pstmt.setString(3, this.apir_short_name);
            pstmt.setString(4, this.apir_brief_name);
            pstmt.setInt(5, this.code);
            // pstmt.setTimestamp ( 7, this.id_old );
            pstmt.setInt(6, this.id);
            pstmt.setString(7, this.apir_pic);

            status = pstmt.executeUpdate();
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }
    }

    /**
     * Stores an entry in the "apir_pic" table. The properties for the entry
     * must be set before storing it.
     */
    public void store() throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("UPDATE ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("SET ");
            pstmt_StringBuffer.append("identifier = ?, ");
            pstmt_StringBuffer.append("[apir_full_name] = ?, ");
            pstmt_StringBuffer.append("[apir_short_name] = ?, ");
            pstmt_StringBuffer.append("[apir_brief_name] = ?, ");
            pstmt_StringBuffer.append("code = ?,  ");
            pstmt_StringBuffer.append("id = ? ");
            pstmt_StringBuffer.append("WHERE [apir_pic] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.identifier);
            pstmt.setString(2, this.apir_full_name);
            pstmt.setString(3, this.apir_short_name);
            pstmt.setString(4, this.apir_brief_name);
            pstmt.setInt(5, this.code);
            // pstmt.setTimestamp ( 7, this.id_old );
            pstmt.setInt(6, this.id);
            pstmt.setString(7, this.apir_pic);

            status = pstmt.executeUpdate();

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public store() : void from class au.com.totemsoft.myplanner.bean.db.ApirPicBean


    /**
     * Search in database table "apir_pic" for all rows whose column name (given
     * as a parameter) contains at least one of the keywords (given) as part of
     * any word in the column. The returned Vector is sorted by the given column
     * name.
     *
     * @param keywords _
     *            the keywords which are used for the search
     * @return a java.util.Vector which contains all rows that match the search
     *         criteria
     */
    private Vector findByKeywordsSearch(String keywords, String column_name)
            throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        StringTokenizer keywords_StringTokenizer = null;
        int token_count = 0;
        int number_of_tokens = 0;
        Vector table_rows = new Vector(INITIAL_VECTOR_SIZE,
                INITIAL_VECTOR_GROWTH_SIZE);
        try (Connection con = sqlHelper.getConnection();) {
            // check if we have some keywords
            if (keywords != null && keywords.length() > 0) {
                // split keywords String into tokens (single keywords)
                keywords_StringTokenizer = new StringTokenizer(keywords);
                number_of_tokens = keywords_StringTokenizer.countTokens();

                // build pstmt query
                pstmt_StringBuffer.append("SELECT DISTINCT ");
                pstmt_StringBuffer
                        .append("[apir_pic], [apir_full_name], code ");
                pstmt_StringBuffer
                        .append("FROM [" + DATABASE_TABLE_NAME + "] ");
                pstmt_StringBuffer.append("WHERE ");
                // add all tokens (single keywords) to the query
                while (keywords_StringTokenizer.hasMoreTokens()) {
                    // do we need to add "AND "?
                    if (token_count > 0 && token_count < number_of_tokens) {
                        pstmt_StringBuffer.append(SEARCH_OPERATOR + " ");
                    }

                    pstmt_StringBuffer.append("([" + column_name + " ] LIKE '%"
                            + keywords_StringTokenizer.nextToken() + "%') ");
                    token_count++;
                }
                // order by description
                pstmt_StringBuffer.append("ORDER BY [" + column_name + "] ");

                // set and execute query
                pstmt = con.prepareStatement(pstmt_StringBuffer.toString());
                rs = pstmt.executeQuery();

                // have we any result?
                while (rs.next()) {
                    // create new row
                    AvailableInvestmentsTableRow table_row = new AvailableInvestmentsTableRow();

                    // fill it with data
                    table_row.origin = checkString(DATABASE_TABLE_NAME);
                    table_row.investmentCode = checkString(rs
                            .getString("apir_pic"));
                    table_row.description = checkString(rs
                            .getString("apir_full_name"));
                    table_row.code = checkString(rs.getString("code"));
                    // store row
                    table_rows.add(table_row);
                }
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return table_rows;
    }

    /**
     * Search in database table "apir_pic" for all rows whose column name (given
     * as a parameter) contains at least one of the keywords (given) as part of
     * any word in the column. The returned Vector is sorted by the given column
     * name.
     *
     * @param keywords _
     *            the keywords which are used for the search
     * @return a java.util.Vector which contains all rows that match the search
     *         criteria
     */
    private Vector findByKeywordsSearch(String keywords, String column_name)
            throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        StringTokenizer keywords_StringTokenizer = null;
        int token_count = 0;
        int number_of_tokens = 0;

        Vector table_rows = new Vector(INITIAL_VECTOR_SIZE,
                INITIAL_VECTOR_GROWTH_SIZE);

        try {
            // get connection
            con = sqlHelper.getConnection();

            // check if we have some keywords
            if (keywords != null && keywords.length() > 0) {
                // split keywords String into tokens (single keywords)
                keywords_StringTokenizer = new StringTokenizer(keywords);
                number_of_tokens = keywords_StringTokenizer.countTokens();

                // build pstmt query
                pstmt_StringBuffer.append("SELECT DISTINCT ");
                pstmt_StringBuffer
                        .append("[apir_pic], [apir_full_name], code ");
                pstmt_StringBuffer
                        .append("FROM [" + DATABASE_TABLE_NAME + "] ");
                pstmt_StringBuffer.append("WHERE ");
                // add all tokens (single keywords) to the query
                while (keywords_StringTokenizer.hasMoreTokens()) {
                    // do we need to add "AND "?
                    if (token_count > 0 && token_count < number_of_tokens) {
                        pstmt_StringBuffer.append(SEARCH_OPERATOR + " ");
                    }

                    pstmt_StringBuffer.append("([" + column_name + " ] LIKE '%"
                            + keywords_StringTokenizer.nextToken() + "%') ");
                    token_count++;
                }
                // order by description
                pstmt_StringBuffer.append("ORDER BY [" + column_name + "] ");

                // set and execute query
                pstmt = con.prepareStatement(pstmt_StringBuffer.toString());
                rs = pstmt.executeQuery();

                // have we any result?
                while (rs.next()) {
                    // create new row
                    AvailableInvestmentsTableRow table_row = new AvailableInvestmentsTableRow();

                    // fill it with data
                    table_row.origin = checkString(DATABASE_TABLE_NAME);
                    table_row.investmentCode = checkString(rs
                            .getString("apir_pic"));
                    table_row.description = checkString(rs
                            .getString("apir_full_name"));
                    table_row.code = checkString(rs.getString("code"));
                    // store row
                    table_rows.add(table_row);
                }
            }
            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return table_rows;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method private findByKeywordsSearch(keywords String, column_name String) : Vector from class au.com.totemsoft.myplanner.bean.db.ApirPicBean


    /**
     * Loads an entry from the "apir_pic" table. The given column name and id is
     * used for identification. The first matching (column contains id) entry
     * will be loaded.
     *
     * @param column_name _
     *            the column name for the search
     * @param id _
     *            the identification
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id)
            throws java.sql.SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [" + column_name + "] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.identifier = rs.getString("identifier");
                this.apir_pic = rs.getString("apir_pic");
                this.apir_full_name = rs.getString("apir_full_name");
                this.apir_short_name = rs.getString("apir_short_name");
                this.apir_brief_name = rs.getString("apir_brief_name");
                this.code = rs.getInt("code");
                // this.id = rs.getInt( "id" );
                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }

        return found;
    }

    /**
     * Loads an entry from the "apir_pic" table. The given column name and id is
     * used for identification. The first matching (column contains id) entry
     * will be loaded.
     *
     * @param column_name _
     *            the column name for the search
     * @param id _
     *            the identification
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id)
            throws java.sql.SQLException {
        Connection con = null;
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [" + column_name + "] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.identifier = rs.getString("identifier");
                this.apir_pic = rs.getString("apir_pic");
                this.apir_full_name = rs.getString("apir_full_name");
                this.apir_short_name = rs.getString("apir_short_name");
                this.apir_brief_name = rs.getString("apir_brief_name");
                this.code = rs.getInt("code");
                // this.id = rs.getInt( "id" );
                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method private findByColumnName(column_name String, id String) : boolean from class au.com.totemsoft.myplanner.bean.db.ApirPicBean


    /**
     */
    public void delete(Integer aaid) throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;
        try (Connection con = sqlHelper.getConnection();) {
            pstmt_StringBuffer = new StringBuffer();

            // build sql query
            pstmt_StringBuffer
                    .append("UPDATE Financial SET AssetAllocationID = NULL ");
            pstmt_StringBuffer.append("WHERE AssetAllocationID = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, aaid.intValue());

            status = pstmt.executeUpdate();

            pstmt_StringBuffer = new StringBuffer();

            // build sql query
            pstmt_StringBuffer.append("DELETE FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE AssetAllocationID = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, aaid.intValue());

            status = pstmt.executeUpdate();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }
    }

    /**
     */
    public void delete(Integer aaid) throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;

        try {
            // get connection
            con = sqlHelper.getConnection();

            pstmt_StringBuffer = new StringBuffer();

            // build sql query
            pstmt_StringBuffer
                    .append("UPDATE Financial SET AssetAllocationID = NULL ");
            pstmt_StringBuffer.append("WHERE AssetAllocationID = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, aaid.intValue());

            status = pstmt.executeUpdate();

            pstmt_StringBuffer = new StringBuffer();

            // build sql query
            pstmt_StringBuffer.append("DELETE FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE AssetAllocationID = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, aaid.intValue());

            status = pstmt.executeUpdate();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public delete(aaid Integer) : void from class au.com.totemsoft.myplanner.bean.db.AssetAllocationBean


    /**
     * Creates a new entry in the "apir_pic" table. The properties for the new
     * entry must be set before creating a new entry.
     */
    public void create() throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer
                    .append("code, inCash, inFixedInterest, inAustShares, inIntnlShares,  ");
            pstmt_StringBuffer.append("inProperty, inOther, dataDate, id");
            pstmt_StringBuffer.append(")");
            pstmt_StringBuffer.append("VALUES ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("?, ?, ?, ?, ?, ?, ?, ?, ? ");
            pstmt_StringBuffer.append(")");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, this.code);
            pstmt.setDouble(2, this.inCash);
            pstmt.setDouble(3, this.inFixedInterest);
            pstmt.setDouble(4, this.inAustShares);
            pstmt.setDouble(5, this.inIntnlShares);
            pstmt.setDouble(6, this.inProperty);
            pstmt.setDouble(7, this.inOther);
            pstmt.setString(8, this.dataDate);
            pstmt.setDouble(9, this.id);

            status = pstmt.executeUpdate();
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }
    }

    /**
     * Creates a new entry in the "apir_pic" table. The properties for the new
     * entry must be set before creating a new entry.
     */
    public void create() throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer
                    .append("code, inCash, inFixedInterest, inAustShares, inIntnlShares,  ");
            pstmt_StringBuffer.append("inProperty, inOther, dataDate, id");
            pstmt_StringBuffer.append(")");
            pstmt_StringBuffer.append("VALUES ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("?, ?, ?, ?, ?, ?, ?, ?, ? ");
            pstmt_StringBuffer.append(")");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, this.code);
            pstmt.setDouble(2, this.inCash);
            pstmt.setDouble(3, this.inFixedInterest);
            pstmt.setDouble(4, this.inAustShares);
            pstmt.setDouble(5, this.inIntnlShares);
            pstmt.setDouble(6, this.inProperty);
            pstmt.setDouble(7, this.inOther);
            pstmt.setString(8, this.dataDate);
            pstmt.setDouble(9, this.id);

            status = pstmt.executeUpdate();

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public create() : void from class au.com.totemsoft.myplanner.bean.db.AssetAllocationDataBean


    /**
     * Loads an entry from the "iress_asset_name" table. The "code" column is
     * used for identification. The first matching entry will be loaded.
     *
     * @param apir_pic_id _
     *            use the apir_pic column as identifier
     * @return true = found an entry
     */
    public boolean findByCode(String code) throws java.sql.SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [code] = ? ");
            pstmt_StringBuffer.append("AND [DataDate] = ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("SELECT max([DataDate]) ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [code] = ? ");
            pstmt_StringBuffer.append(")");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, code);
            pstmt.setString(2, code);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.code = rs.getInt("code");
                this.inCash = rs.getDouble("InCash");
                this.inFixedInterest = rs.getDouble("InFixedInterest");
                this.inAustShares = rs.getDouble("InAustShares");
                this.inIntnlShares = rs.getDouble("InIntnlShares");
                this.inProperty = rs.getDouble("InProperty");
                this.inOther = rs.getDouble("InOther");
                this.dataDate = rs.getString("DataDate");
                this.id = rs.getDouble("id");

                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }

        return found;
    }

    /**
     * Loads an entry from the "iress_asset_name" table. The "code" column is
     * used for identification. The first matching entry will be loaded.
     *
     * @param apir_pic_id _
     *            use the apir_pic column as identifier
     * @return true = found an entry
     */
    public boolean findByCode(String code) throws java.sql.SQLException {
        Connection con = null;
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [code] = ? ");
            pstmt_StringBuffer.append("AND [DataDate] = ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("SELECT max([DataDate]) ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [code] = ? ");
            pstmt_StringBuffer.append(")");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, code);
            pstmt.setString(2, code);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.code = rs.getInt("code");
                this.inCash = rs.getDouble("InCash");
                this.inFixedInterest = rs.getDouble("InFixedInterest");
                this.inAustShares = rs.getDouble("InAustShares");
                this.inIntnlShares = rs.getDouble("InIntnlShares");
                this.inProperty = rs.getDouble("InProperty");
                this.inOther = rs.getDouble("InOther");
                this.dataDate = rs.getString("DataDate");
                this.id = rs.getDouble("id");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findByCode(code String) : boolean from class au.com.totemsoft.myplanner.bean.db.AssetAllocationDataBean


    /**
     * Loads an entry from the "iress_asset_name" table. The given column name
     * and id is used for identification. The first matching (column contains
     * id) entry will be loaded.
     *
     * @param column_name _
     *            the column name for the search
     * @param id _
     *            the identification
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id)
            throws java.sql.SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT * FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE ");
            pstmt_StringBuffer.append("[" + column_name + "] = ?");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, id);
            pstmt.setString(2, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.code = rs.getInt("code");
                this.inCash = rs.getDouble("InCash");
                this.inFixedInterest = rs.getDouble("InFixedInterest");
                this.inAustShares = rs.getDouble("InAustShares");
                this.inIntnlShares = rs.getDouble("InIntnlShares");
                this.inProperty = rs.getDouble("InProperty");
                this.inOther = rs.getDouble("InOther");
                this.dataDate = rs.getString("DataDate");
                this.id = rs.getDouble("id");

                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }

        return found;
    }

    /**
     * Loads an entry from the "iress_asset_name" table. The given column name
     * and id is used for identification. The first matching (column contains
     * id) entry will be loaded.
     *
     * @param column_name _
     *            the column name for the search
     * @param id _
     *            the identification
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id)
            throws java.sql.SQLException {
        Connection con = null;
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("SELECT * FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE ");
            pstmt_StringBuffer.append("[" + column_name + "] = ?");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, id);
            pstmt.setString(2, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.code = rs.getInt("code");
                this.inCash = rs.getDouble("InCash");
                this.inFixedInterest = rs.getDouble("InFixedInterest");
                this.inAustShares = rs.getDouble("InAustShares");
                this.inIntnlShares = rs.getDouble("InIntnlShares");
                this.inProperty = rs.getDouble("InProperty");
                this.inOther = rs.getDouble("InOther");
                this.dataDate = rs.getString("DataDate");
                this.id = rs.getDouble("id");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method private findByColumnName(column_name String, id String) : boolean from class au.com.totemsoft.myplanner.bean.db.AssetAllocationDataBean


    public boolean findByFinancialCodeIdAndFinancialTypeId(
            String financial_code_id, String financialTypeID)
            throws SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeID] = ? ");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, financial_code_id);
            pstmt.setString(2, financialTypeID);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return found;
    }

    public boolean findByFinancialCodeIdAndFinancialTypeId(
            String financial_code_id, String financialTypeID)
            throws SQLException {
        Connection con = sqlHelper.getConnection();
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeID] = ? ");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, financial_code_id);
            pstmt.setString(2, financialTypeID);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findByFinancialCodeIdAndFinancialTypeId(financial_code_id String, financialTypeID String) : boolean from class au.com.totemsoft.myplanner.bean.db.FinancialCodeBean


    public boolean findByFinancialCodeDescAndFinancialTypeId(
            String financialCodeDesc, String financialTypeID)
            throws SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeDesc] LIKE '%"
                    + financialCodeDesc + "%'");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            // pstmt.setString ( 1, financialCodeDesc );
            pstmt.setString(1, financialTypeID);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return found;
    }

    public boolean findByFinancialCodeDescAndFinancialTypeId(
            String financialCodeDesc, String financialTypeID)
            throws SQLException {
        Connection con = sqlHelper.getConnection();
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeDesc] LIKE '%"
                    + financialCodeDesc + "%'");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            // pstmt.setString ( 1, financialCodeDesc );
            pstmt.setString(1, financialTypeID);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findByFinancialCodeDescAndFinancialTypeId(financialCodeDesc String, financialTypeID String) : boolean from class au.com.totemsoft.myplanner.bean.db.FinancialCodeBean


    /**
     * Loads an entry from the "FinancialCode" table. The given
     * financial_code_id and financialCodeDesc is used for identification. The
     * first matching entry will be loaded.
     *
     * @param financialCodeDesc
     * @param financial_code_id
     * @return true = found an entry
     */
    public boolean findByFinancialCodeDescAndFinancialCodeId(
            String financialCodeDesc, String financial_code_id)
            throws SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeDesc] LIKE '%"
                    + financialCodeDesc + "%'");
            pstmt_StringBuffer.append("AND   [FinancialCodeID] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            // pstmt.setString ( 1, financialCodeDesc );
            pstmt.setString(1, financial_code_id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return found;
    }

    /**
     * Loads an entry from the "FinancialCode" table. The given
     * financial_code_id and financialCodeDesc is used for identification. The
     * first matching entry will be loaded.
     *
     * @param financialCodeDesc
     * @param financial_code_id
     * @return true = found an entry
     */
    public boolean findByFinancialCodeDescAndFinancialCodeId(
            String financialCodeDesc, String financial_code_id)
            throws SQLException {
        Connection con = sqlHelper.getConnection();
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeDesc] LIKE '%"
                    + financialCodeDesc + "%'");
            pstmt_StringBuffer.append("AND   [FinancialCodeID] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            // pstmt.setString ( 1, financialCodeDesc );
            pstmt.setString(1, financial_code_id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findByFinancialCodeDescAndFinancialCodeId(financialCodeDesc String, financial_code_id String) : boolean from class au.com.totemsoft.myplanner.bean.db.FinancialCodeBean


    /**
     * Loads an entry from the "FinancialCode" table. The given
     * financial_code_id and financialTypeID and financial_code is used for
     * identification. The first matching entry will be loaded.
     *
     * @param financialCodeDesc
     * @param financialTypeID
     * @param financial_code
     * @return true = found an entry
     */
    public boolean findByFinancialCodeDescAndFinancialTypeIdAndFinancialCode(
            String financialCodeDesc, String financialTypeID,
            String financial_code) throws SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT DISTINCT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeDesc] LIKE '%"
                    + financialCodeDesc + "%'");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");
            pstmt_StringBuffer.append("AND   [FinancialCode] LIKE '%"
                    + financial_code + "%'");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            // pstmt.setString ( 1, financialCodeDesc );
            pstmt.setString(1, financialTypeID);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return found;
    }

    /**
     * Loads an entry from the "FinancialCode" table. The given
     * financial_code_id and financialTypeID and financial_code is used for
     * identification. The first matching entry will be loaded.
     *
     * @param financialCodeDesc
     * @param financialTypeID
     * @param financial_code
     * @return true = found an entry
     */
    public boolean findByFinancialCodeDescAndFinancialTypeIdAndFinancialCode(
            String financialCodeDesc, String financialTypeID,
            String financial_code) throws SQLException {
        Connection con = sqlHelper.getConnection();
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // build sql query
            pstmt_StringBuffer.append("SELECT DISTINCT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeDesc] LIKE '%"
                    + financialCodeDesc + "%'");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");
            pstmt_StringBuffer.append("AND   [FinancialCode] LIKE '%"
                    + financial_code + "%'");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            // pstmt.setString ( 1, financialCodeDesc );
            pstmt.setString(1, financialTypeID);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findByFinancialCodeDescAndFinancialTypeIdAndFinancialCode(financialCodeDesc String, financialTypeID String, financial_code String) : boolean from class au.com.totemsoft.myplanner.bean.db.FinancialCodeBean


    /**
     * Loads an entry from the "FinancialCode" table. The given
     * financial_code_id and financialTypeID and financial_code is used for
     * identification. The first matching entry will be loaded.
     *
     * @param financialCodeDesc
     * @param financialTypeID
     * @param financial_code_id
     * @return true = found an entry
     */
    public boolean findByFinancialCodeDescAndFinancialTypeIdAndFinancialCodeId(
            String financialCodeDesc, int financialTypeID, int financial_code_id)
            throws SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT DISTINCT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeDesc] LIKE '%"
                    + financialCodeDesc + "%'");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");
            pstmt_StringBuffer
                    .append(financial_code_id > 0 ? "AND   [FinancialCodeID] = ? "
                            : "AND   [FinancialCodeID] IS NULL ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, financialTypeID);
            if (financial_code_id > 0)
                pstmt.setInt(2, financial_code_id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return found;
    }

    /**
     * Loads an entry from the "FinancialCode" table. The given
     * financial_code_id and financialTypeID and financial_code is used for
     * identification. The first matching entry will be loaded.
     *
     * @param financialCodeDesc
     * @param financialTypeID
     * @param financial_code_id
     * @return true = found an entry
     */
    public boolean findByFinancialCodeDescAndFinancialTypeIdAndFinancialCodeId(
            String financialCodeDesc, int financialTypeID, int financial_code_id)
            throws SQLException {
        Connection con = sqlHelper.getConnection();
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // build sql query
            pstmt_StringBuffer.append("SELECT DISTINCT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCodeDesc] LIKE '%"
                    + financialCodeDesc + "%'");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");
            pstmt_StringBuffer
                    .append(financial_code_id > 0 ? "AND   [FinancialCodeID] = ? "
                            : "AND   [FinancialCodeID] IS NULL ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, financialTypeID);
            if (financial_code_id > 0)
                pstmt.setInt(2, financial_code_id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findByFinancialCodeDescAndFinancialTypeIdAndFinancialCodeId(financialCodeDesc String, financialTypeID int, financial_code_id int) : boolean from class au.com.totemsoft.myplanner.bean.db.FinancialCodeBean


    public boolean findByFinancialCodeAndFinancialTypeId(String financial_code,
            String financialTypeID) throws SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCode] = ? ");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, financial_code);
            pstmt.setString(2, financialTypeID);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return found;
    }

    public boolean findByFinancialCodeAndFinancialTypeId(String financial_code,
            String financialTypeID) throws SQLException {
        Connection con = sqlHelper.getConnection();
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [FinancialCode] = ? ");
            pstmt_StringBuffer.append("AND   [FinancialTypeID] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, financial_code);
            pstmt.setString(2, financialTypeID);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.financialCodeID = rs.getInt("FinancialCodeID");
                this.financialTypeID = rs.getInt("FinancialTypeID");
                this.financialCode = rs.getString("FinancialCode");
                this.financialCodeDesc = rs.getString("FinancialCodeDesc");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findByFinancialCodeAndFinancialTypeId(financial_code String, financialTypeID String) : boolean from class au.com.totemsoft.myplanner.bean.db.FinancialCodeBean


    /**
     * Creates a new entry in the "FinancialCodeBean" table. The properties for
     * the new entry must be set before creating a new entry. (Updates the
     * FinancialCodeID!)
     */
    public void create() throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;
        try (Connection con = sqlHelper.getConnection();) {
            // get max. FinancialCodeID
            // build sql query
            pstmt_StringBuffer.append("SELECT MAX(FundTypeID) ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());
            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.fundTypeID = rs.getInt(1);
                // create new "unique" FinancialCodeID
                this.fundTypeID++;
            }
            // close ResultSet and PreparedStatement
            sqlHelper.close(rs, pstmt);

            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("(FundTypeID, FundTypeDesc) ");
            pstmt_StringBuffer.append("VALUES ( ?, ? )");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, this.fundTypeID);
            pstmt.setString(2, this.fundTypeDesc);

            status = pstmt.executeUpdate();
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }
    }

    /**
     * Creates a new entry in the "FinancialCodeBean" table. The properties for
     * the new entry must be set before creating a new entry. (Updates the
     * FinancialCodeID!)
     */
    public void create() throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;

        try {
            // get connection
            con = sqlHelper.getConnection();

            // get max. FinancialCodeID
            // build sql query
            pstmt_StringBuffer.append("SELECT MAX(FundTypeID) ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());
            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.fundTypeID = rs.getInt(1);
                // create new "unique" FinancialCodeID
                this.fundTypeID++;
            }
            // close ResultSet and PreparedStatement
            sqlHelper.close(rs, pstmt);

            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("(FundTypeID, FundTypeDesc) ");
            pstmt_StringBuffer.append("VALUES ( ?, ? )");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, this.fundTypeID);
            pstmt.setString(2, this.fundTypeDesc);

            status = pstmt.executeUpdate();

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public create() : void from class au.com.totemsoft.myplanner.bean.db.FundTypeBean


    /**
     * Stores an entry in the "FinancialCodeBean" table. The properties for the
     * entry must be set before storing it.
     */
    public void store() throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("UPDATE ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("SET ");
            pstmt_StringBuffer.append("FundTypeDesc = ? ");
            pstmt_StringBuffer.append("WHERE FundTypeID = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.fundTypeDesc);
            pstmt.setInt(2, this.fundTypeID);

            status = pstmt.executeUpdate();
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }
    }

    /**
     * Stores an entry in the "FinancialCodeBean" table. The properties for the
     * entry must be set before storing it.
     */
    public void store() throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("UPDATE ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("SET ");
            pstmt_StringBuffer.append("FundTypeDesc = ? ");
            pstmt_StringBuffer.append("WHERE FundTypeID = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.fundTypeDesc);
            pstmt.setInt(2, this.fundTypeID);

            status = pstmt.executeUpdate();

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public store() : void from class au.com.totemsoft.myplanner.bean.db.FundTypeBean


    /**
     * Loads an entry from the "FinancialCode" table. The given column name and
     * id is used for identification. The first matching (column contains id)
     * entry will be loaded.
     *
     * @param column_name -
     *            the column name for the search
     * @param id -
     *            the identification
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id)
            throws java.sql.SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [" + column_name + "] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.fundTypeID = rs.getInt("FundTypeID");
                this.fundTypeDesc = rs.getString("FundTypeDesc");

                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return found;
    }

    /**
     * Loads an entry from the "FinancialCode" table. The given column name and
     * id is used for identification. The first matching (column contains id)
     * entry will be loaded.
     *
     * @param column_name -
     *            the column name for the search
     * @param id -
     *            the identification
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id)
            throws java.sql.SQLException {
        Connection con = null;
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [" + column_name + "] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.fundTypeID = rs.getInt("FundTypeID");
                this.fundTypeDesc = rs.getString("FundTypeDesc");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method private findByColumnName(column_name String, id String) : boolean from class au.com.totemsoft.myplanner.bean.db.FundTypeBean


    /**
     * Creates a new entry in the "FinancialCodeBean" table. The properties for
     * the new entry must be set before creating a new entry. (Updates the
     * FinancialCodeID!)
     */
    public void create() throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;
        try (Connection con = sqlHelper.getConnection();) {
            // get max. FinancialCodeID
            // build sql query
            pstmt_StringBuffer.append("SELECT MAX(institutionID) ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());
            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.institutionID = rs.getInt(1);
                // create new "unique" FinancialCodeID
                this.institutionID++;
            }
            // close ResultSet and PreparedStatement
            sqlHelper.close(rs, pstmt);

            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("(institutionID, institutionName) ");
            pstmt_StringBuffer.append("VALUES ( ?, ? )");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, this.institutionID);
            pstmt.setString(2, this.institutionName);

            status = pstmt.executeUpdate();
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }
    }

    /**
     * Creates a new entry in the "FinancialCodeBean" table. The properties for
     * the new entry must be set before creating a new entry. (Updates the
     * FinancialCodeID!)
     */
    public void create() throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;

        try {
            // get connection
            con = sqlHelper.getConnection();

            // get max. FinancialCodeID
            // build sql query
            pstmt_StringBuffer.append("SELECT MAX(institutionID) ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());
            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.institutionID = rs.getInt(1);
                // create new "unique" FinancialCodeID
                this.institutionID++;
            }
            // close ResultSet and PreparedStatement
            sqlHelper.close(rs, pstmt);

            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("(institutionID, institutionName) ");
            pstmt_StringBuffer.append("VALUES ( ?, ? )");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setInt(1, this.institutionID);
            pstmt.setString(2, this.institutionName);

            status = pstmt.executeUpdate();

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public create() : void from class au.com.totemsoft.myplanner.bean.db.InstitutionBean


    /**
     * Stores an entry in the "FinancialCodeBean" table. The properties for the
     * entry must be set before storing it.
     */
    public void store() throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("UPDATE ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("SET ");
            pstmt_StringBuffer.append("institutionName = ? ");
            pstmt_StringBuffer.append("WHERE InstitutionID = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.institutionName);
            pstmt.setInt(2, this.institutionID);

            status = pstmt.executeUpdate();
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }
    }

    /**
     * Stores an entry in the "FinancialCodeBean" table. The properties for the
     * entry must be set before storing it.
     */
    public void store() throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("UPDATE ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("SET ");
            pstmt_StringBuffer.append("institutionName = ? ");
            pstmt_StringBuffer.append("WHERE InstitutionID = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.institutionName);
            pstmt.setInt(2, this.institutionID);

            status = pstmt.executeUpdate();

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public store() : void from class au.com.totemsoft.myplanner.bean.db.InstitutionBean


    /**
     * Loads an entry from the "Institution" table. The given column name and id
     * is used for identification. The first matching (column contains id) entry
     * will be loaded.
     *
     * @param column_name -
     *            the column name for the search
     * @param id -
     *            the identification
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id)
            throws java.sql.SQLException {
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [" + column_name + "] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.institutionID = rs.getInt("InstitutionID");
                this.institutionName = rs.getString("InstitutionName");

                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return found;
    }

    /**
     * Loads an entry from the "Institution" table. The given column name and id
     * is used for identification. The first matching (column contains id) entry
     * will be loaded.
     *
     * @param column_name -
     *            the column name for the search
     * @param id -
     *            the identification
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id)
            throws java.sql.SQLException {
        Connection con = null;
        boolean found = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("SELECT * ");
            pstmt_StringBuffer.append("FROM ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("WHERE [" + column_name + "] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.institutionID = rs.getInt("InstitutionID");
                this.institutionName = rs.getString("InstitutionName");

                found = true;
            }

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return found;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method private findByColumnName(column_name String, id String) : boolean from class au.com.totemsoft.myplanner.bean.db.InstitutionBean


    /**
     * Creates a new entry in the "apir_pic" table. The properties for the new
     * entry must be set before creating a new entry.
     */
    public void create() throws java.sql.SQLException {
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("code, [asset_full_name], ");
            pstmt_StringBuffer
                    .append("issuerName, issuerAbbName, issuerShortName, issuerType, ");
            pstmt_StringBuffer.append("securityType, ");
            pstmt_StringBuffer.append("exchange, industrySubgroup, ");
            pstmt_StringBuffer
                    .append("description, shortDescription, abbDescription, ");
            pstmt_StringBuffer.append("assetBacking, ");
            pstmt_StringBuffer.append("issuerCode, issuerExchange, ");
            pstmt_StringBuffer
                    .append("industrySubgroupDesc, industryGroupDesc, ");
            pstmt_StringBuffer.append("isin, gics ");
            pstmt_StringBuffer.append(")");
            pstmt_StringBuffer.append("VALUES ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("?, ?, ?, ?, ?, ?, ?, ?, ? , ?, ");
            pstmt_StringBuffer.append("?, ?, ?, ?, ?, ?, ?, ?, ? ");
            pstmt_StringBuffer.append(")");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.code);
            pstmt.setString(2, this.asset_full_name);
            pstmt.setString(3, this.issuerName);
            pstmt.setString(4, this.issuerAbbName);
            pstmt.setString(5, this.issuerShortName);
            pstmt.setString(6, this.issuerType);
            pstmt.setDouble(7, this.securityType);
            pstmt.setString(8, this.exchange);
            pstmt.setDouble(9, this.industrySubgroup);
            pstmt.setString(10, this.description);
            pstmt.setString(11, this.shortDescription);
            pstmt.setString(12, this.abbDescription);
            pstmt.setDouble(13, this.assetBacking);
            pstmt.setString(14, this.issuerCode);
            pstmt.setString(15, this.issuerExchange);
            pstmt.setString(16, this.industrySubgroupDesc);
            pstmt.setString(17, this.industryGroupDesc);
            pstmt.setString(18, this.isin);
            pstmt.setDouble(19, this.gics);

            status = pstmt.executeUpdate();
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }
    }

    /**
     * Creates a new entry in the "apir_pic" table. The properties for the new
     * entry must be set before creating a new entry.
     */
    public void create() throws java.sql.SQLException {
        Connection con = null;
        PreparedStatement pstmt = null;
        StringBuffer pstmt_StringBuffer = new StringBuffer();
        int status = 0;

        try {
            // get connection
            con = sqlHelper.getConnection();

            // build sql query
            pstmt_StringBuffer.append("INSERT INTO ");
            pstmt_StringBuffer.append("[" + DATABASE_TABLE_NAME + "] ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("code, [asset_full_name], ");
            pstmt_StringBuffer
                    .append("issuerName, issuerAbbName, issuerShortName, issuerType, ");
            pstmt_StringBuffer.append("securityType, ");
            pstmt_StringBuffer.append("exchange, industrySubgroup, ");
            pstmt_StringBuffer
                    .append("description, shortDescription, abbDescription, ");
            pstmt_StringBuffer.append("assetBacking, ");
            pstmt_StringBuffer.append("issuerCode, issuerExchange, ");
            pstmt_StringBuffer
                    .append("industrySubgroupDesc, industryGroupDesc, ");
            pstmt_StringBuffer.append("isin, gics ");
            pstmt_StringBuffer.append(")");
            pstmt_StringBuffer.append("VALUES ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("?, ?, ?, ?, ?, ?, ?, ?, ? , ?, ");
            pstmt_StringBuffer.append("?, ?, ?, ?, ?, ?, ?, ?, ? ");
            pstmt_StringBuffer.append(")");

            // set and execute query
            pstmt = con.prepareStatement(pstmt_StringBuffer.toString());

            pstmt.setString(1, this.code);
            pstmt.setString(2, this.asset_full_name);
            pstmt.setString(3, this.issuerName);
            pstmt.setString(4, this.issuerAbbName);
            pstmt.setString(5, this.issuerShortName);
            pstmt.setString(6, this.issuerType);
            pstmt.setDouble(7, this.securityType);
            pstmt.setString(8, this.exchange);
            pstmt.setDouble(9, this.industrySubgroup);
            pstmt.setString(10, this.description);
            pstmt.setString(11, this.shortDescription);
            pstmt.setString(12, this.abbDescription);
            pstmt.setDouble(13, this.assetBacking);
            pstmt.setString(14, this.issuerCode);
            pstmt.setString(15, this.issuerExchange);
            pstmt.setString(16, this.industrySubgroupDesc);
            pstmt.setString(17, this.industryGroupDesc);
            pstmt.setString(18, this.isin);
            pstmt.setDouble(19, this.gics);

            status = pstmt.executeUpdate();

            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(null, pstmt, con);
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public create() : void from class au.com.totemsoft.myplanner.bean.db.IressAssetNameBean


    /**
     * Search in database table "iress_asset" for all rows whose column name
     * (given as a parameter) contains at least one of the keywords (given) as
     * part of any word in the column. The returned Vector is sorted by the
     * given column name.
     *
     * @param keywords _
     *            the keywords which are used for the search
     * @param column_name _
     *            the column name to look for
     * @return a java.util.Vector which contains all rows that match the search
     *         criteria
     */
    public Vector findByKeywordsSearchDescription(String keywords, String column_name) throws java.sql.SQLException {
        if (StringUtils.isBlank(keywords) || StringUtils.isBlank(column_name)) {
            return new Vector();
        }
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer();
        StringTokenizer tok = null;
        int token_count = 0;
        int number_of_tokens = 0;

        Vector table_rows = new Vector(INITIAL_VECTOR_SIZE, INITIAL_VECTOR_GROWTH_SIZE);
        column_name = column_name.trim();
        try (Connection con = sqlHelper.getConnection();) {
            // check if we have some keywords
            if (keywords != null && keywords.length() > 0) {
                // split keywords String into tokens (single keywords)
                tok = new StringTokenizer(keywords);
                number_of_tokens = tok.countTokens();

                // build pstmt query
                sql.append("SELECT DISTINCT ");
                sql.append("[code], [asset_full_name], [issuerName] ");
                sql.append("FROM [" + DATABASE_TABLE_NAME + "] ");
                sql.append("WHERE (");
                // add all tokens (single keywords) to the query
                while (tok.hasMoreTokens()) {
                    // do we need to add "AND "?
                    if (token_count > 0 && token_count < number_of_tokens) {
                        sql.append(SEARCH_OPERATOR + " ");
                    }
                    sql.append("([" + column_name + "] LIKE '%" + tok.nextToken() + "%') ");
                    token_count++;
                }
                sql.append(") ");
                // order by description
                sql.append("ORDER BY [" + column_name + "] ");

                // set and execute query
                pstmt = con.prepareStatement(sql.toString());
                rs = pstmt.executeQuery();

                // have we any result?
                while (rs.next()) {
                    // create new row
                    AvailableInvestmentsTableRow table_row = new AvailableInvestmentsTableRow();

                    // fill it with data
                    table_row.origin = checkString(DATABASE_TABLE_NAME);
                    table_row.investmentCode = checkString(rs.getString("code"));
                    table_row.description = checkString(rs
                            .getString("asset_full_name"));
                    table_row.code = checkString(rs.getString("code"));
                    table_row.institution = checkString(rs
                            .getString("issuerName"));
                    // store row
                    table_rows.add(table_row);
                }
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }

        return table_rows;
    }

    /**
     * Search in database table "iress_asset" for all rows whose column name
     * (given as a parameter) contains at least one of the keywords (given) as
     * part of any word in the column. The returned Vector is sorted by the
     * given column name.
     *
     * @param keywords _
     *            the keywords which are used for the search
     * @param column_name _
     *            the column name to look for
     * @return a java.util.Vector which contains all rows that match the search
     *         criteria
     */
    public Vector findByKeywordsSearchDescription(String keywords, String column_name) throws java.sql.SQLException {
        if (StringUtils.isBlank(keywords) || StringUtils.isBlank(column_name))
            return new Vector();

        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer();
        StringTokenizer tok = null;
        int token_count = 0;
        int number_of_tokens = 0;

        Vector table_rows = new Vector(INITIAL_VECTOR_SIZE, INITIAL_VECTOR_GROWTH_SIZE);
        column_name = column_name.trim();
        try {
            // get connection
            con = sqlHelper.getConnection();

            // check if we have some keywords
            if (keywords != null && keywords.length() > 0) {
                // split keywords String into tokens (single keywords)
                tok = new StringTokenizer(keywords);
                number_of_tokens = tok.countTokens();

                // build pstmt query
                sql.append("SELECT DISTINCT ");
                sql.append("[code], [asset_full_name], [issuerName] ");
                sql.append("FROM [" + DATABASE_TABLE_NAME + "] ");
                sql.append("WHERE (");
                // add all tokens (single keywords) to the query
                while (tok.hasMoreTokens()) {
                    // do we need to add "AND "?
                    if (token_count > 0 && token_count < number_of_tokens) {
                        sql.append(SEARCH_OPERATOR + " ");
                    }
                    sql.append("([" + column_name + "] LIKE '%" + tok.nextToken() + "%') ");
                    token_count++;
                }
                sql.append(") ");
                // order by description
                sql.append("ORDER BY [" + column_name + "] ");

                // set and execute query
                pstmt = con.prepareStatement(sql.toString());
                rs = pstmt.executeQuery();

                // have we any result?
                while (rs.next()) {
                    // create new row
                    AvailableInvestmentsTableRow table_row = new AvailableInvestmentsTableRow();

                    // fill it with data
                    table_row.origin = checkString(DATABASE_TABLE_NAME);
                    table_row.investmentCode = checkString(rs.getString("code"));
                    table_row.description = checkString(rs
                            .getString("asset_full_name"));
                    table_row.code = checkString(rs.getString("code"));
                    table_row.institution = checkString(rs
                            .getString("issuerName"));
                    // store row
                    table_rows.add(table_row);
                }
            }
            // autocommit is off
            //con.commit();

        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            //con.rollback();
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt, con);
        }

        return table_rows;
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findByKeywordsSearchDescription(keywords String, column_name String) : Vector from class au.com.totemsoft.myplanner.bean.db.IressAssetNameBean