public Profile findProfile(int profileId) throws Exception {
        Profile profile = null;
        PreparedStatement statement = null;
        ResultSet results = null;

        try (Connection sqlConnection = sqlService.getConnection()) {
            statement = sqlConnection.prepareStatement(
                "SELECT * FROM " + Constants.DB_TABLE_PROFILE +
                    " WHERE " + Constants.GENERIC_ID + " = ?"
            );
            statement.setInt(1, profileId);
            results = statement.executeQuery();
            if (results.next()) {
                profile = this.getProfileFromResultSet(results);
            }
        } catch (Exception e) {
            throw e;
        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
        return profile;
    }
public Profile findProfile ( int profileId ) throws Exception { Profile profile = null ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_PROFILE + " WHERE " + Constants . GENERIC_ID + " = ?" ) ; statement . setInt ( 1 , profileId ) ; results = statement . executeQuery ( ) ; if ( results . next ( ) ) { profile = this . getProfileFromResultSet ( results ) ; } } catch ( Exception e ) { throw e ; } finally { try { if ( results != null ) { results . close ( ) ; } } catch ( Exception e ) { } try { if ( statement != null ) { statement . close ( ) ; } } catch ( Exception e ) { } } return profile ; }
Returns a specific profile

@param profileId ID of profile
@return Selected profile if found, null if not found
@throws Exception exception