public List < Profile > findAllProfiles ( ) throws Exception { ArrayList < Profile > allProfiles = new ArrayList <> ( ) ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { statement = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_PROFILE ) ; results = statement . executeQuery ( ) ; while ( results . next ( ) ) { allProfiles . add ( 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 allProfiles ; }
Returns a collection of all profiles