public Integer getIdFromName(String profileName) {
        PreparedStatement query = null;
        ResultSet results = null;

        try (Connection sqlConnection = sqlService.getConnection()) {
            query = sqlConnection.prepareStatement("SELECT * FROM " + Constants.DB_TABLE_PROFILE +
                                                       " WHERE " + Constants.PROFILE_PROFILE_NAME + " = ?");
            query.setString(1, profileName);
            results = query.executeQuery();
            if (results.next()) {
                Object toReturn = results.getObject(Constants.GENERIC_ID);
                query.close();
                return (Integer) toReturn;
            }
            query.close();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (query != null) {
                    query.close();
                }
            } catch (Exception e) {
            }
        }
        return null;
    }
public Integer getIdFromName ( String profileName ) { PreparedStatement query = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { query = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_PROFILE + " WHERE " + Constants . PROFILE_PROFILE_NAME + " = ?" ) ; query . setString ( 1 , profileName ) ; results = query . executeQuery ( ) ; if ( results . next ( ) ) { Object toReturn = results . getObject ( Constants . GENERIC_ID ) ; query . close ( ) ; return ( Integer ) toReturn ; } query . close ( ) ; } catch ( SQLException e ) { e . printStackTrace ( ) ; } finally { try { if ( results != null ) { results . close ( ) ; } } catch ( Exception e ) { } try { if ( query != null ) { query . close ( ) ; } } catch ( Exception e ) { } } return null ; }
Obtain the ID associated with a profile name

@param profileName profile name
@return ID of profile