    /**
     * 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);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.code = rs.getString("code");
                this.asset_full_name = rs.getString("asset_full_name");
                this.issuerName = rs.getString("IssuerName");
                this.issuerAbbName = rs.getString("IssuerAbbName");
                this.issuerShortName = rs.getString("IssuerShortName");
                this.issuerType = rs.getString("IssuerType");
                this.securityType = rs.getDouble("SecurityType");
                this.exchange = rs.getString("Exchange");
                this.industrySubgroup = rs.getDouble("IndustrySubgroup");
                this.description = rs.getString("Description");
                this.shortDescription = rs.getString("ShortDescription");
                this.abbDescription = rs.getString("AbbDescription");
                this.assetBacking = rs.getDouble("AssetBacking");
                this.issuerCode = rs.getString("IssuerCode");
                this.issuerExchange = rs.getString("IssuerExchange");
                this.industrySubgroupDesc = rs
                        .getString("IndustrySubgroupDesc");
                this.industryGroupDesc = rs.getString("IndustryGroupDesc");
                this.isin = rs.getString("ISIN");
                this.gics = rs.getDouble("GICS");

                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);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.code = rs.getString("code");
                this.asset_full_name = rs.getString("asset_full_name");
                this.issuerName = rs.getString("IssuerName");
                this.issuerAbbName = rs.getString("IssuerAbbName");
                this.issuerShortName = rs.getString("IssuerShortName");
                this.issuerType = rs.getString("IssuerType");
                this.securityType = rs.getDouble("SecurityType");
                this.exchange = rs.getString("Exchange");
                this.industrySubgroup = rs.getDouble("IndustrySubgroup");
                this.description = rs.getString("Description");
                this.shortDescription = rs.getString("ShortDescription");
                this.abbDescription = rs.getString("AbbDescription");
                this.assetBacking = rs.getDouble("AssetBacking");
                this.issuerCode = rs.getString("IssuerCode");
                this.issuerExchange = rs.getString("IssuerExchange");
                this.industrySubgroupDesc = rs
                        .getString("IndustrySubgroupDesc");
                this.industryGroupDesc = rs.getString("IndustryGroupDesc");
                this.isin = rs.getString("ISIN");
                this.gics = rs.getDouble("GICS");

                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.IressAssetNameBean


    /**
     * 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.country_code = rs.getString("country_code");
                this.code = rs.getString("code");
                this.full_name = rs.getString("full_name");
                this.status = rs.getString("status");
                this.short_name = rs.getString("short_name");
                this.brief_name = rs.getString("brief_name");
                this.very_brief_name = rs.getString("very_brief_name");
                this.group_code = rs.getString("group_code");
                this.consolidated_code = rs.getString("consolidated_code");
                // this.id = rs.getTimestamp( "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.country_code = rs.getString("country_code");
                this.code = rs.getString("code");
                this.full_name = rs.getString("full_name");
                this.status = rs.getString("status");
                this.short_name = rs.getString("short_name");
                this.brief_name = rs.getString("brief_name");
                this.very_brief_name = rs.getString("very_brief_name");
                this.group_code = rs.getString("group_code");
                this.consolidated_code = rs.getString("consolidated_code");
                // this.id = rs.getTimestamp( "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.ManagerDataBean


    /**
     * 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.code = rs.getInt("code");
                this.full_name = rs.getString("full_name");
                this.country_code = rs.getString("country_code");
                this.tax_group_code = rs.getString("tax_group_code");
                this.manager_code = rs.getString("manager_code");
                this.group_code = rs.getInt("group_code");
                this.short_name = rs.getString("short_name");
                this.brief_name = rs.getString("brief_name");
                this.legal_type_code = rs.getString("legal_type_code");
                this.region_code = rs.getString("region_code");
                this.asset_type_code = rs.getString("asset_type_code");
                this.cash_distribution_code = rs
                        .getString("cash_distribution_code");
                this.trustee_code = rs.getString("trustee_code");
                this.custodian_code = rs.getString("custodian_code");
                // this.commencement_date = rs.getTimestamp( "commencement_date");
                // this.data_date = rs.getTimestamp( "data_date" );
                this.stock_exchange = rs.getInt("stock_exchange");
                this.guarantees = rs.getInt("guarantees");
                this.unit_linked = rs.getInt("unit_linked");
                this.valuation_frequency = rs.getString("valuation_frequency");
                this.declared_yield = rs.getInt("declared_yield");
                this.rate_of_return_advance = rs
                        .getInt("rate_of_return_advance");
                this.category = rs.getString("category");
                this.subcategory = rs.getString("subcategory");
                this.manager_group_code = rs.getString("manager_group_code");
                this.gearing = rs.getInt("gearing");
                this.gearing_max = rs.getDouble("gearing_max");
                this.gearing_comments = rs.getString("gearing_comments");
                this.special_features = rs.getString("special_features");
                // this.id = rs.getTimestamp( "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.code = rs.getInt("code");
                this.full_name = rs.getString("full_name");
                this.country_code = rs.getString("country_code");
                this.tax_group_code = rs.getString("tax_group_code");
                this.manager_code = rs.getString("manager_code");
                this.group_code = rs.getInt("group_code");
                this.short_name = rs.getString("short_name");
                this.brief_name = rs.getString("brief_name");
                this.legal_type_code = rs.getString("legal_type_code");
                this.region_code = rs.getString("region_code");
                this.asset_type_code = rs.getString("asset_type_code");
                this.cash_distribution_code = rs
                        .getString("cash_distribution_code");
                this.trustee_code = rs.getString("trustee_code");
                this.custodian_code = rs.getString("custodian_code");
                // this.commencement_date = rs.getTimestamp( "commencement_date");
                // this.data_date = rs.getTimestamp( "data_date" );
                this.stock_exchange = rs.getInt("stock_exchange");
                this.guarantees = rs.getInt("guarantees");
                this.unit_linked = rs.getInt("unit_linked");
                this.valuation_frequency = rs.getString("valuation_frequency");
                this.declared_yield = rs.getInt("declared_yield");
                this.rate_of_return_advance = rs
                        .getInt("rate_of_return_advance");
                this.category = rs.getString("category");
                this.subcategory = rs.getString("subcategory");
                this.manager_group_code = rs.getString("manager_group_code");
                this.gearing = rs.getInt("gearing");
                this.gearing_max = rs.getDouble("gearing_max");
                this.gearing_comments = rs.getString("gearing_comments");
                this.special_features = rs.getString("special_features");
                // this.id = rs.getTimestamp( "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.ProductInformationBean


    /**
     *
     * @param code
     * @param full_name
     * @return true = found an entry
     */
    public boolean containsCodeFullName(int code, String full_name)
            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 ");
            pstmt_StringBuffer.append("[full_name] = ? ");

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

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

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }

        return found;
    }

    /**
     *
     * @param code
     * @param full_name
     * @return true = found an entry
     */
    public boolean containsCodeFullName(int code, String full_name)
            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 ");
            pstmt_StringBuffer.append("[full_name] = ? ");

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

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

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                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 containsCodeFullName(code int, full_name String) : boolean from class au.com.totemsoft.myplanner.bean.db.ProductInformationBean


    /**
     * Creates a new entry in the "share_price_data" 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("(code, [price_date], [open_price], [close_price]) ");
            pstmt_StringBuffer.append("VALUES ( ?, ?, ?, ? )");

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

            pstmt.setString(1, this.code);
            pstmt.setString(2, this.price_date);
            pstmt.setDouble(3, this.open_price);
            pstmt.setDouble(4, this.close_price);

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

    /**
     * Creates a new entry in the "share_price_data" 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("(code, [price_date], [open_price], [close_price]) ");
            pstmt_StringBuffer.append("VALUES ( ?, ?, ?, ? )");

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

            pstmt.setString(1, this.code);
            pstmt.setString(2, this.price_date);
            pstmt.setDouble(3, this.open_price);
            pstmt.setDouble(4, this.close_price);

            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.SharePriceDataBean


    /**
     * Stores an entry in the "share_price_data" 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("[price_date] = ?, ");
            pstmt_StringBuffer.append("[open_price] = ?, ");
            pstmt_StringBuffer.append("[close_price] = ?  ");
            pstmt_StringBuffer.append("WHERE code = ? ");

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

            pstmt.setString(1, this.price_date);
            pstmt.setDouble(2, this.open_price);
            pstmt.setDouble(3, this.close_price);
            pstmt.setString(4, this.code);

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

    /**
     * Stores an entry in the "share_price_data" 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("[price_date] = ?, ");
            pstmt_StringBuffer.append("[open_price] = ?, ");
            pstmt_StringBuffer.append("[close_price] = ?  ");
            pstmt_StringBuffer.append("WHERE code = ? ");

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

            pstmt.setString(1, this.price_date);
            pstmt.setDouble(2, this.open_price);
            pstmt.setDouble(3, this.close_price);
            pstmt.setString(4, this.code);

            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.SharePriceDataBean


    /**
     * Loads an entry from the "unit_price_data" table. The "code" column is
     * used for identification. The first matching entry will be loaded.
     *
     * @param code_id _
     *            use the code column as identifier
     * @return true = found an entry
     */
    public boolean findByCode(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 [code] = ? ");
            pstmt_StringBuffer.append("AND [price_date] = ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("SELECT max([price_date]) ");
            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, id);
            pstmt.setString(2, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.code = rs.getString("code");
                // this.price_date = rs.getString ( "price_date" );
                setPriceDate2(rs.getDate("price_date"));
                this.open_price = rs.getDouble("open_price");
                this.close_price = rs.getDouble("close_price");

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

        return found;
    }

    /**
     * Loads an entry from the "unit_price_data" table. The "code" column is
     * used for identification. The first matching entry will be loaded.
     *
     * @param code_id _
     *            use the code column as identifier
     * @return true = found an entry
     */
    public boolean findByCode(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 [code] = ? ");
            pstmt_StringBuffer.append("AND [price_date] = ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("SELECT max([price_date]) ");
            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, id);
            pstmt.setString(2, id);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                // get the data
                this.code = rs.getString("code");
                // this.price_date = rs.getString ( "price_date" );
                setPriceDate2(rs.getDate("price_date"));
                this.open_price = rs.getDouble("open_price");
                this.close_price = rs.getDouble("close_price");

                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(id String) : boolean from class au.com.totemsoft.myplanner.bean.db.SharePriceDataBean


    /**
     * Loads an entry from the "unit_price_data" 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
     * @param add_sql_str _
     *            additional sql statment for example: ORDER BY ...
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id,
            String add_sql_str) 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 + "] = ? ");

            if (add_sql_str != null) {
                pstmt_StringBuffer.append(" " + add_sql_str);
            }

            // 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.getString("code");
                // this.price_date = rs.getString ( "price_date" );
                setPriceDate2(rs.getDate("price_date"));
                this.open_price = rs.getDouble("open_price");
                this.close_price = rs.getDouble("close_price");

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

        return found;
    }

    /**
     * Loads an entry from the "unit_price_data" 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
     * @param add_sql_str _
     *            additional sql statment for example: ORDER BY ...
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id,
            String add_sql_str) 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 + "] = ? ");

            if (add_sql_str != null) {
                pstmt_StringBuffer.append(" " + add_sql_str);
            }

            // 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.getString("code");
                // this.price_date = rs.getString ( "price_date" );
                setPriceDate2(rs.getDate("price_date"));
                this.open_price = rs.getDouble("open_price");
                this.close_price = rs.getDouble("close_price");

                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, add_sql_str String) : boolean from class au.com.totemsoft.myplanner.bean.db.SharePriceDataBean


    /**
     * Search in the "three tables" 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 {
        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("b.code, b.[full_name], a.[full_name] AS institution, c.[apir_pic] ");
                sql.append("FROM [" + MANAGER_DATA_DATABASE_TABLE_NAME + "] a, ");
                sql.append("[" + PRODUCT_INFORMATION_DATABASE_TABLE_NAME + "] b, ");
                sql.append("[" + APIR_PIC_DATABASE_TABLE_NAME + "] c ");
                sql.append("WHERE ");
                sql.append("a.code = b.[manager_code] AND b.code = c.code AND ");
                // add all tokens (single keywords) to the query
                sql.append("(");
                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(APIR_PIC_DATABASE_TABLE_NAME);
                    table_row.investmentCode = checkString(rs
                            .getString("apir_pic"));
                    table_row.description = checkString(rs
                            .getString("full_name"));
                    table_row.code = checkString(rs.getString("code"));
                    table_row.institution = checkString(rs
                            .getString("institution"));
                    // 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 the "three tables" 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 {
        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("b.code, b.[full_name], a.[full_name] AS institution, c.[apir_pic] ");
                sql.append("FROM [" + MANAGER_DATA_DATABASE_TABLE_NAME + "] a, ");
                sql.append("[" + PRODUCT_INFORMATION_DATABASE_TABLE_NAME + "] b, ");
                sql.append("[" + APIR_PIC_DATABASE_TABLE_NAME + "] c ");
                sql.append("WHERE ");
                sql.append("a.code = b.[manager_code] AND b.code = c.code AND ");
                // add all tokens (single keywords) to the query
                sql.append("(");
                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(APIR_PIC_DATABASE_TABLE_NAME);
                    table_row.investmentCode = checkString(rs
                            .getString("apir_pic"));
                    table_row.description = checkString(rs
                            .getString("full_name"));
                    table_row.code = checkString(rs.getString("code"));
                    table_row.institution = checkString(rs
                            .getString("institution"));
                    // 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.UnitInformationSearchBean


    /**
     * Loads an entry. 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 pstmt query
            pstmt_StringBuffer.append("SELECT DISTINCT ");
            pstmt_StringBuffer
                    .append("b.code, b.[full_name], a.[full_name] AS institution, c.[apir_pic] ");

            pstmt_StringBuffer.append("FROM ["
                    + MANAGER_DATA_DATABASE_TABLE_NAME + "] a, ");
            pstmt_StringBuffer.append("["
                    + PRODUCT_INFORMATION_DATABASE_TABLE_NAME + "] b, ");
            pstmt_StringBuffer.append("[" + APIR_PIC_DATABASE_TABLE_NAME
                    + "] c");

            pstmt_StringBuffer.append("WHERE ");
            pstmt_StringBuffer
                    .append("a.code = b.[manager_code] AND b.code = c.code AND");
            pstmt_StringBuffer.append(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.apir_pic = rs.getString("apir_pic");
                this.full_name = rs.getString("full_name");
                this.institution = rs.getString("institution");
                this.code = rs.getInt("code");
                found = true;
            }
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(null, pstmt);
        }

        return found;
    }

    /**
     * Loads an entry. 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 pstmt query
            pstmt_StringBuffer.append("SELECT DISTINCT ");
            pstmt_StringBuffer
                    .append("b.code, b.[full_name], a.[full_name] AS institution, c.[apir_pic] ");

            pstmt_StringBuffer.append("FROM ["
                    + MANAGER_DATA_DATABASE_TABLE_NAME + "] a, ");
            pstmt_StringBuffer.append("["
                    + PRODUCT_INFORMATION_DATABASE_TABLE_NAME + "] b, ");
            pstmt_StringBuffer.append("[" + APIR_PIC_DATABASE_TABLE_NAME
                    + "] c");

            pstmt_StringBuffer.append("WHERE ");
            pstmt_StringBuffer
                    .append("a.code = b.[manager_code] AND b.code = c.code AND");
            pstmt_StringBuffer.append(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.apir_pic = rs.getString("apir_pic");
                this.full_name = rs.getString("full_name");
                this.institution = rs.getString("institution");
                this.code = rs.getInt("code");
                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.UnitInformationSearchBean


    /**
     * 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, code, [price_date], [entry_price], [exit_price]) ");
            pstmt_StringBuffer.append("VALUES ( ?, ?, ?, ?, ? )");

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

            pstmt.setString(1, this.identifier);
            pstmt.setInt(2, this.code);
            pstmt.setString(3, this.price_date);
            pstmt.setDouble(4, this.entry_price);
            pstmt.setDouble(5, this.exit_price);
            // pstmt.setString ( 6, 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, code, [price_date], [entry_price], [exit_price]) ");
            pstmt_StringBuffer.append("VALUES ( ?, ?, ?, ?, ? )");

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

            pstmt.setString(1, this.identifier);
            pstmt.setInt(2, this.code);
            pstmt.setString(3, this.price_date);
            pstmt.setDouble(4, this.entry_price);
            pstmt.setDouble(5, this.exit_price);
            // pstmt.setString ( 6, 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.UnitPriceDataBean


    /**
     * 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("[price_date] = ?, ");
            pstmt_StringBuffer.append("[entry_price] = ?, ");
            pstmt_StringBuffer.append("[exit_price] = ?  ");
            // pstmt_StringBuffer.append ( "id = ? " );
            pstmt_StringBuffer.append("WHERE code = ? ");

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

            pstmt.setString(1, this.identifier);
            pstmt.setString(2, this.price_date);
            pstmt.setDouble(3, this.entry_price);
            pstmt.setDouble(4, this.exit_price);
            // pstmt.setString ( 5, this.id );
            pstmt.setInt(5, this.code);

            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("[price_date] = ?, ");
            pstmt_StringBuffer.append("[entry_price] = ?, ");
            pstmt_StringBuffer.append("[exit_price] = ?  ");
            // pstmt_StringBuffer.append ( "id = ? " );
            pstmt_StringBuffer.append("WHERE code = ? ");

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

            pstmt.setString(1, this.identifier);
            pstmt.setString(2, this.price_date);
            pstmt.setDouble(3, this.entry_price);
            pstmt.setDouble(4, this.exit_price);
            // pstmt.setString ( 5, this.id );
            pstmt.setInt(5, this.code);

            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.UnitPriceDataBean


    /**
     * Loads an entry from the "unit_price_data" table. The "code" column is
     * used for identification. The first matching entry will be loaded.
     *
     * @param code_id _
     *            use the code column as identifier
     * @return true = found an entry
     */
    public boolean findByCode(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 [code] = ? ");
            pstmt_StringBuffer.append("AND [price_date] = ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("SELECT max([price_date]) ");
            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());

            // transform String to int
            int code_int = -1;
            try {
                if (id != null && id.length() > 0) {
                    code_int = Integer.parseInt(id);
                }
            } catch (java.lang.NumberFormatException e) {
            }

            pstmt.setInt(1, code_int);
            pstmt.setInt(2, code_int);

            rs = pstmt.executeQuery();

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

        return found;
    }

    /**
     * Loads an entry from the "unit_price_data" table. The "code" column is
     * used for identification. The first matching entry will be loaded.
     *
     * @param code_id _
     *            use the code column as identifier
     * @return true = found an entry
     */
    public boolean findByCode(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 [code] = ? ");
            pstmt_StringBuffer.append("AND [price_date] = ");
            pstmt_StringBuffer.append("(");
            pstmt_StringBuffer.append("SELECT max([price_date]) ");
            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());

            // transform String to int
            int code_int = -1;
            try {
                if (id != null && id.length() > 0) {
                    code_int = Integer.parseInt(id);
                }
            } catch (java.lang.NumberFormatException e) {
            }

            pstmt.setInt(1, code_int);
            pstmt.setInt(2, code_int);

            rs = pstmt.executeQuery();

            // do we have any result?
            if (rs.next()) {
                found = true;
                // get the data
                this.identifier = rs.getString("identifier");
                this.code = rs.getInt("code");
                // this.price_date = rs.getString ( "price_date" );
                setPriceDate2(rs.getDate("price_date"));
                this.entry_price = rs.getDouble("entry_price");
                this.exit_price = rs.getDouble("exit_price");
                this.id = rs.getString("id");
            }

            // 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(id String) : boolean from class au.com.totemsoft.myplanner.bean.db.UnitPriceDataBean


    /**
     * Loads an entry from the "unit_price_data" 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
     * @param add_sql_str _
     *            additional sql statment for example: ORDER BY ...
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id,
            String add_sql_str) 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 + "] = ? ");

            if (add_sql_str != null) {
                pstmt_StringBuffer.append(" " + add_sql_str);
            }

            // 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.code = rs.getInt("code");
                // this.price_date = rs.getString ( "price_date" );
                setPriceDate2(rs.getDate("price_date"));
                this.entry_price = rs.getDouble("entry_price");
                this.exit_price = rs.getDouble("exit_price");
                this.id = rs.getString("id");

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

        return found;
    }

    /**
     * Loads an entry from the "unit_price_data" 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
     * @param add_sql_str _
     *            additional sql statment for example: ORDER BY ...
     * @return true = found an entry
     */
    private boolean findByColumnName(String column_name, String id,
            String add_sql_str) 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 + "] = ? ");

            if (add_sql_str != null) {
                pstmt_StringBuffer.append(" " + add_sql_str);
            }

            // 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.code = rs.getInt("code");
                // this.price_date = rs.getString ( "price_date" );
                setPriceDate2(rs.getDate("price_date"));
                this.entry_price = rs.getDouble("entry_price");
                this.exit_price = rs.getDouble("exit_price");
                this.id = rs.getString("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, add_sql_str String) : boolean from class au.com.totemsoft.myplanner.bean.db.UnitPriceDataBean


    @Override
    public FinancialCode findByColumnName(String column_name, String id) throws SQLException {
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            sql.append("SELECT * ");
            sql.append("FROM ");
            sql.append("[" + FinancialCode.TABLE_NAME + "] ");
            sql.append("WHERE [" + column_name + "] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(sql.toString());
            pstmt.setString(1, id);
            rs = pstmt.executeQuery();
            // do we have any result?
            FinancialCode result = null;
            if (rs.next()) {
                result = new FinancialCode();
                result.setId(rs.getInt("FinancialCodeID"));
                result.setFinancialTypeId(rs.getInt("FinancialTypeID"));
                result.setCode(rs.getString("FinancialCode"));
                result.setDescription(rs.getString("FinancialCodeDesc"));
            }
            return result;
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }
    }

    @Override
    public FinancialCode findByColumnName(String column_name, String id) throws SQLException {
        Connection con = sqlHelper.getConnection();
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer();
        try {
            // build sql query
            sql.append("SELECT * ");
            sql.append("FROM ");
            sql.append("[" + FinancialCode.TABLE_NAME + "] ");
            sql.append("WHERE [" + column_name + "] = ? ");

            // set and execute query
            pstmt = con.prepareStatement(sql.toString());
            pstmt.setString(1, id);
            rs = pstmt.executeQuery();
            // do we have any result?
            FinancialCode result = null;
            if (rs.next()) {
                result = new FinancialCode();
                result.setId(rs.getInt("FinancialCodeID"));
                result.setFinancialTypeId(rs.getInt("FinancialTypeID"));
                result.setCode(rs.getString("FinancialCode"));
                result.setDescription(rs.getString("FinancialCodeDesc"));
            }
            // autocommit is off
            //con.commit();
            return result;
        } 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 findByColumnName(column_name String, id String) : FinancialCode from class au.com.totemsoft.myplanner.dao.hibernate.FinancialCodeDaoImpl


    @Override
    public Vector findByKeywords(String keywords, String column_name) throws 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();
        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("[FinancialCode], [FinancialCodeDesc] ");
                sql.append("FROM [" + FinancialCode.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("OR ");
                    }
                    sql.append("[" + column_name + "] LIKE '%" + tok.nextToken() + "%' ");
                    token_count++;
                }
                // select only user created FinancialCodes, they start with '#'
                sql.append(" OR [FinancialCode] LIKE '#%'");
                sql.append(") ");
                //
                sql.append(" AND LogicallyDeleted IS NULL ");
                // 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(FinancialCode.TABLE_NAME);
                    table_row.investmentCode = checkString(rs.getString(FinancialCode.COLUMN_CODE));
                    table_row.description = checkString(rs.getString(FinancialCode.COLUMN_DESC));
                    table_row.code = "";
                    table_row.institution = "";
                    // store row
                    table_rows.add(table_row);
                }
            }
            return table_rows;
        } catch (SQLException e) {
            sqlHelper.printSQLException(e);
            throw e;
        } finally {
            sqlHelper.close(rs, pstmt);
        }
    }

    @Override
    public Vector findByKeywords(String keywords, String column_name) throws 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();
        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("[FinancialCode], [FinancialCodeDesc] ");
                sql.append("FROM [" + FinancialCode.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("OR ");
                    }
                    sql.append("[" + column_name + "] LIKE '%" + tok.nextToken() + "%' ");
                    token_count++;
                }
                // select only user created FinancialCodes, they start with '#'
                sql.append(" OR [FinancialCode] LIKE '#%'");
                sql.append(") ");
                //
                sql.append(" AND LogicallyDeleted IS NULL ");
                // 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(FinancialCode.TABLE_NAME);
                    table_row.investmentCode = checkString(rs.getString(FinancialCode.COLUMN_CODE));
                    table_row.description = checkString(rs.getString(FinancialCode.COLUMN_DESC));
                    table_row.code = "";
                    table_row.institution = "";
                    // store row
                    table_rows.add(table_row);
                }
            }
            // autocommit is off
            //con.commit();
            return table_rows;
        } 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 findByKeywords(keywords String, column_name String) : Vector from class au.com.totemsoft.myplanner.dao.hibernate.FinancialCodeDaoImpl


    @Override
    public void create(FinancialCode entity) throws SQLException {
        Integer financialTypeId = entity.getFinancialTypeId();
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // get max. FinancialCodeID
            // build sql query
            sql.append("SELECT MAX(FinancialCodeID) ");
            sql.append("FROM ");
            sql.append("[" + FinancialCode.TABLE_NAME + "] ");
            // set and execute query
            pstmt = con.prepareStatement(sql.toString());
            rs = pstmt.executeQuery();

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

            // build sql query
            sql.setLength(0);
            sql.append("INSERT INTO ");
            sql.append("[" + FinancialCode.TABLE_NAME + "] ");
            sql.append("(FinancialCodeID, FinancialTypeID, FinancialCode, FinancialCodeDesc) ");
            sql.append("VALUES ( ?, ?, ?, ? )");

            // set and execute query
            pstmt = con.prepareStatement(sql.toString());
            pstmt.setInt(1, financialCodeId);
            // pstmt.setInt (2, this.financialTypeId); // should already
            // exists in FinancialType table
            if (financialTypeId != null && financialTypeId > 0) {
                pstmt.setInt(2, financialTypeId);
            } else {
                pstmt.setInt(2, FinancialTypeEnum.UNDEFINED.getId());
            }
            pstmt.setString(3, entity.getCode());
            pstmt.setString(4, entity.getDescription());

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

    @Override
    public void create(FinancialCode entity) throws SQLException {
        Integer financialTypeId = entity.getFinancialTypeId();
        Connection con = sqlHelper.getConnection();
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer();
        try {
            // get max. FinancialCodeID
            // build sql query
            sql.append("SELECT MAX(FinancialCodeID) ");
            sql.append("FROM ");
            sql.append("[" + FinancialCode.TABLE_NAME + "] ");
            // set and execute query
            pstmt = con.prepareStatement(sql.toString());
            rs = pstmt.executeQuery();

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

            // build sql query
            sql.setLength(0);
            sql.append("INSERT INTO ");
            sql.append("[" + FinancialCode.TABLE_NAME + "] ");
            sql.append("(FinancialCodeID, FinancialTypeID, FinancialCode, FinancialCodeDesc) ");
            sql.append("VALUES ( ?, ?, ?, ? )");

            // set and execute query
            pstmt = con.prepareStatement(sql.toString());
            pstmt.setInt(1, financialCodeId);
            // pstmt.setInt (2, this.financialTypeId); // should already
            // exists in FinancialType table
            if (financialTypeId != null && financialTypeId > 0) {
                pstmt.setInt(2, financialTypeId);
            } else {
                pstmt.setInt(2, FinancialTypeEnum.UNDEFINED.getId());
            }
            pstmt.setString(3, entity.getCode());
            pstmt.setString(4, entity.getDescription());

            /*int status = */pstmt.executeUpdate();

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

            // System.out.println( "FinancialCode created: " + this );

        } 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(entity FinancialCode) : void from class au.com.totemsoft.myplanner.dao.hibernate.FinancialCodeDaoImpl


    @Override
    public void store(FinancialCode entity) throws SQLException {
        PreparedStatement pstmt = null;
        StringBuffer sql = new StringBuffer();
        try (Connection con = sqlHelper.getConnection();) {
            // build sql query
            sql.append("UPDATE ");
            sql.append("[" + FinancialCode.TABLE_NAME + "] ");
            sql.append("SET ");
            sql.append("FinancialTypeID = ?, ");
            sql.append("FinancialCode = ?, ");
            sql.append("FinancialCodeDesc = ? ");
            sql.append("WHERE FinancialCodeID = ? ");

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

            Integer financialTypeId = entity.getFinancialType().getId();
            if (financialTypeId > 0) {
                pstmt.setInt(1, financialTypeId);
            } else {
                pstmt.setInt(1, FinancialTypeEnum.UNDEFINED.getId());
            }
            pstmt.setString(2, entity.getCode());
            pstmt.setString(3, entity.getDescription());
            pstmt.setInt(4, entity.getId());

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

    @Override
    public void store(FinancialCode entity) throws SQLException {
        Connection con = sqlHelper.getConnection();
        PreparedStatement pstmt = null;
        StringBuffer sql = new StringBuffer();
        try {
            // build sql query
            sql.append("UPDATE ");
            sql.append("[" + FinancialCode.TABLE_NAME + "] ");
            sql.append("SET ");
            sql.append("FinancialTypeID = ?, ");
            sql.append("FinancialCode = ?, ");
            sql.append("FinancialCodeDesc = ? ");
            sql.append("WHERE FinancialCodeID = ? ");

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

            Integer financialTypeId = entity.getFinancialType().getId();
            if (financialTypeId > 0) {
                pstmt.setInt(1, financialTypeId);
            } else {
                pstmt.setInt(1, FinancialTypeEnum.UNDEFINED.getId());
            }
            pstmt.setString(2, entity.getCode());
            pstmt.setString(3, entity.getDescription());
            pstmt.setInt(4, entity.getId());

            int count = pstmt.executeUpdate();

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

            System.out.println("" + count + " FinancialCode updated: " + this);

        } 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(entity FinancialCode) : void from class au.com.totemsoft.myplanner.dao.hibernate.FinancialCodeDaoImpl


    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void setOwnerPrimaryKey(Object value) throws ServiceException {
        // value has to be Integer
        Integer id = value == null ? null : ((Number) value).intValue();
        if (equals(id, getOwnerId()))
            return;
        try (Connection con = sqlHelper.getConnection();) {
            linkObjectDao.unlink(getOwnerId(), getId(), USER_2_CLIENT, con);
            if (id != null)
                linkObjectDao.link(id, getId(), USER_2_CLIENT, con);
            setOwnerId(id);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public void setOwnerPrimaryKey(Object value) throws ServiceException {
        // value has to be Integer
        Integer id = value == null ? null : ((Number) value).intValue();
        if (equals(id, getOwnerId()))
            return;
        try {
            Connection con = sqlHelper.getConnection();
            linkObjectDao.unlink(getOwnerId(), getId(), USER_2_CLIENT, con);
            if (id != null)
                linkObjectDao.link(id, getId(), USER_2_CLIENT, con);
            setOwnerId(id);
            sqlHelper.close(con);
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public setOwnerPrimaryKey(value Object) : void from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    public boolean validatePassword(String password) throws ServiceException {
        PreparedStatement sql = null;
        ResultSet rs = null;
        boolean validate = false;
        try (Connection con = sqlHelper.getConnection();) {
            sql = con.prepareStatement(
            // "SELECT ClientPersonID FROM ClientPerson WHERE ( ClientPersonID =
            // ?)"
                    "Select LoginName from UserPerson where"
                            + " ( UserPersonID = ?)"
                            + " AND ( LoginPassword = ? ) ");
            int i = 0;
            sql.setInt(++i, getOwnerId().intValue());
            sql.setString(++i, password);

            rs = sql.executeQuery();

            if (rs.next())
                validate = true;

            close(rs, sql);
            rs = null;
            sql = null;

            return validate;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                close(rs, sql);
            } catch (SQLException e) {
                throw new ServiceException(e.getMessage());
            }
        }

    }

    public boolean validatePassword(String password) throws ServiceException {
        PreparedStatement sql = null;
        ResultSet rs = null;
        boolean validate = false;
        try {
            Connection con = this.sqlHelper.getConnection();
            sql = con.prepareStatement(
            // "SELECT ClientPersonID FROM ClientPerson WHERE ( ClientPersonID =
            // ?)"
                    "Select LoginName from UserPerson where"
                            + " ( UserPersonID = ?)"
                            + " AND ( LoginPassword = ? ) ");
            int i = 0;
            sql.setInt(++i, getOwnerId().intValue());
            sql.setString(++i, password);

            rs = sql.executeQuery();

            if (rs.next())
                validate = true;

            close(rs, sql);
            rs = null;
            sql = null;
            sqlHelper.close(con);

            return validate;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        } finally {
            try {
                close(rs, sql);
            } catch (SQLException e) {
                throw new ServiceException(e.getMessage());
            }
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public validatePassword(password String) : boolean from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public Long createClient() throws ServiceException, CreateException {
        final IUser user = userPreferences.getUser();
        final Integer ownerId = user.getId().intValue();

        PreparedStatement sql = null;
        try (Connection con = sqlHelper.getConnection();) {
            // get new ObjectID for client
            Integer personId = getNewObjectID(CLIENT_PERSON, con);

            // add to Person table
//            Person p = new Person();
//            p.setId(personId.longValue());
//            personDao.persist(p);
//            personDao.flushAndClear();
            sql = con.prepareStatement("INSERT INTO Person (PersonID) VALUES (?)");
            sql.setInt(1, personId);
            sql.executeUpdate();
            LOG.info("createClient: person #" + personId);

            // add to ClientPerson table
//            Client c = new Client();
//            c.setId(personId.longValue());
//            clientDao.persist(c);
//            clientDao.flushAndClear();
            sql = con.prepareStatement("INSERT INTO ClientPerson (ClientPersonID) VALUES (?)");
            sql.setInt(1, personId);
            sql.executeUpdate();
            LOG.info("createClient: client #" + personId);

            // link user and client
            if (ownerId != null) {
                linkObjectDao.link(ownerId, personId, USER_2_CLIENT, con);
            }
            setId(personId);

            //
            return personId.longValue();
        } catch (SQLException e) {
            throw new CreateException(e.getMessage());
        } catch (Exception e) {
            throw new ServiceException(e);
        } finally {
            try {
                close(null, sql);
            } catch (SQLException e) {
                throw new ServiceException(e.getMessage());
            }
        }
    }

    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    @Override
    public Long createClient() throws ServiceException, CreateException {
        final IUser user = userPreferences.getUser();
        final Integer ownerId = user.getId().intValue();

//        personDao
//        Client c = new Client();
//        c.set
//        clientDao.persist(c);
//        LOG.info("saveClient: " + c.getId());
//        return c.getId();

        PreparedStatement sql = null;
        try {
            Connection con = sqlHelper.getConnection();
            // get new ObjectID for client
            Integer personId = getNewObjectID(CLIENT_PERSON, con);
            // add to Person table
            sql = con.prepareStatement("INSERT INTO Person (PersonID) VALUES (?)");
            sql.setInt(1, personId);
            sql.executeUpdate();
            // add to ClientPerson table
            sql = con.prepareStatement("INSERT INTO ClientPerson (ClientPersonID) VALUES (?)");
            sql.setInt(1, personId);
            sql.executeUpdate();
            // link user and client
            if (ownerId != null) {
                linkObjectDao.link(ownerId, personId, USER_2_CLIENT, con);
            }
            setId(personId);
            sqlHelper.close(con);
            return personId.longValue();
        } catch (SQLException e) {
            throw new CreateException(e.getMessage());
        } catch (Exception e) {
            throw new ServiceException(e);
        } finally {
            try {
                close(null, sql);
            } catch (SQLException e) {
                throw new ServiceException(e.getMessage());
            }
        }
    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public createClient() : Long from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    /**
     * Description of the Method
     *
     * @param personID
     *            Description of the Parameter
     * @return Description of the Return Value
     * @exception ServiceException
     *                Description of the Exception
     * @exception FinderException
     *                Description of the Exception
     */
    public Integer findByPrimaryKey(Integer personID) throws ServiceException,
            FinderException {
        PreparedStatement sql = null;
        ResultSet rs = null;
        try (Connection con = sqlHelper.getConnection();) {
            // sql = con.
            sql = con.prepareStatement(
            // "SELECT ClientPersonID FROM ClientPerson WHERE ( ClientPersonID =
            // ?)"
                    "SELECT ObjectID1, Active, FeeDate, ReviewDate"
                            + " FROM Link l, ClientPerson c"
                            + " WHERE"
                            + " ( ClientPersonID = ?)"
                            + " AND ( l.LinkObjectTypeID = ? ) AND ( l.ObjectID2 = c.ClientPersonID )"
                            + " AND ( l.LogicallyDeleted IS NULL )");

            int i = 0;
            sql.setInt(++i, personID.intValue());
            sql.setInt(++i, USER_2_CLIENT); // 2003

            rs = sql.executeQuery();

            if (!rs.next())
                throw new ObjectNotFoundException("Can not find client ID: "
                        + personID);

            Integer ownerPrimaryKeyID = (Integer) rs.getObject(1); // user

            String s = rs.getString(2);
            if (s == null)
                active = false;
            else if (BooleanCode.rcNO.getCode().compareToIgnoreCase(s) == 0)
                active = false;
            else if (BooleanCode.rcYES.getCode().compareToIgnoreCase(s) == 0)
                active = true;

            setFeeDate(rs.getDate("FeeDate"));
            setReviewDate(rs.getDate("ReviewDate"));

            close(rs, sql);
            rs = null;
            sql = null;

            // we need client personal information
            load(personID, con);

            // setId( personID );
            setOwnerId(ownerPrimaryKeyID);

            return personID;
        } catch (ObjectNotFoundException e) {
            throw new FinderException(e);
        } catch (SQLException sqle) {
            throw new FinderException(sqle);
        } finally {
            try {
                close(rs, sql);
            } catch (SQLException e) {
                throw new ServiceException(e.getMessage());
            }
        }

    }

    /**
     * Description of the Method
     *
     * @param personID
     *            Description of the Parameter
     * @return Description of the Return Value
     * @exception ServiceException
     *                Description of the Exception
     * @exception FinderException
     *                Description of the Exception
     */
    public Integer findByPrimaryKey(Integer personID) throws ServiceException,
            FinderException {

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

        try {
            con = this.sqlHelper.getConnection();

            // sql = con.
            sql = con.prepareStatement(
            // "SELECT ClientPersonID FROM ClientPerson WHERE ( ClientPersonID =
            // ?)"
                    "SELECT ObjectID1, Active, FeeDate, ReviewDate"
                            + " FROM Link l, ClientPerson c"
                            + " WHERE"
                            + " ( ClientPersonID = ?)"
                            + " AND ( l.LinkObjectTypeID = ? ) AND ( l.ObjectID2 = c.ClientPersonID )"
                            + " AND ( l.LogicallyDeleted IS NULL )");

            int i = 0;
            sql.setInt(++i, personID.intValue());
            sql.setInt(++i, USER_2_CLIENT); // 2003

            rs = sql.executeQuery();

            if (!rs.next())
                throw new ObjectNotFoundException("Can not find client ID: "
                        + personID);

            Integer ownerPrimaryKeyID = (Integer) rs.getObject(1); // user

            String s = rs.getString(2);
            if (s == null)
                active = false;
            else if (BooleanCode.rcNO.getCode().compareToIgnoreCase(s) == 0)
                active = false;
            else if (BooleanCode.rcYES.getCode().compareToIgnoreCase(s) == 0)
                active = true;

            setFeeDate(rs.getDate("FeeDate"));
            setReviewDate(rs.getDate("ReviewDate"));

            close(rs, sql);
            rs = null;
            sql = null;

            // we need client personal information
            load(personID, con);

            // setId( personID );
            setOwnerId(ownerPrimaryKeyID);

            return personID;
        } catch (ObjectNotFoundException e) {
            throw new FinderException(e);
        } catch (SQLException sqle) {
            throw new FinderException(sqle);
        } finally {
            try {
                close(rs, sql);
                if (con != null)
                    sqlHelper.close(con);
            } catch (SQLException e) {
                throw new ServiceException(e.getMessage());
            }
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public findByPrimaryKey(personID Integer) : Integer from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    /**
     * @return The partnerPrimaryKeyID value
     * @exception ServiceException
     *                Description of the Exception
     */
    private Integer getPartnerPrimaryKeyID() throws ServiceException {

        if (partner != null)
            return partner.getId();

        try (Connection con = sqlHelper.getConnection();) {
            List list = getLinkedObjects(CLIENT_2_PERSON, PARTNER,
                    CLIENT$PERSON_2_RELATIONSHIP_FINANCE, con);
            return list == null || list.size() == 0 ? null : (Integer) list
                    .get(list.size() - 1);
            // last one with max ID

        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

    /**
     * @return The partnerPrimaryKeyID value
     * @exception ServiceException
     *                Description of the Exception
     */
    private Integer getPartnerPrimaryKeyID() throws ServiceException {

        if (partner != null)
            return partner.getId();

        try {
            Connection con = sqlHelper.getConnection();
            List list = getLinkedObjects(CLIENT_2_PERSON, PARTNER,
                    CLIENT$PERSON_2_RELATIONSHIP_FINANCE, con);
            sqlHelper.close(con);
            return list == null || list.size() == 0 ? null : (Integer) list
                    .get(list.size() - 1);
            // last one with max ID

        } catch (SQLException e) {
            e.printStackTrace(System.err);
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method private getPartnerPrimaryKeyID() : Integer from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl


    /**
     * @return list of strategies
     * @exception ServiceException
     *                Description of the Exception
     */
    public Collection getStrategies() throws ServiceException {
        try (Connection con = sqlHelper.getConnection();) {
            Collection result = getStrategies(con);
            return result;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

    /**
     * @return list of strategies
     * @exception ServiceException
     *                Description of the Exception
     */
    public Collection getStrategies() throws ServiceException {

        try {
            Connection con = sqlHelper.getConnection();
            Collection result = getStrategies(con);
            sqlHelper.close(con);
            return result;
        } catch (SQLException e) {
            throw new ServiceException(e.getMessage());
        }

    }

Try With Resources try(Connection con=sqlHelper.getConnection()) in method public getStrategies() : Collection from class au.com.totemsoft.myplanner.service.impl.ClientServiceImpl