public List < Client > findAllClients ( int profileId ) throws Exception { ArrayList < Client > clients = new ArrayList < Client > ( ) ; PreparedStatement query = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { query = sqlConnection . prepareStatement ( "SELECT * FROM " + Constants . DB_TABLE_CLIENT + " WHERE " + Constants . GENERIC_PROFILE_ID + " = ?" ) ; query . setInt ( 1 , profileId ) ; results = query . executeQuery ( ) ; while ( results . next ( ) ) { clients . add ( this . getClientFromResultSet ( results ) ) ; } } catch ( Exception e ) { throw e ; } finally { try { if ( results != null ) { results . close ( ) ; } } catch ( Exception e ) { } try { if ( query != null ) { query . close ( ) ; } } catch ( Exception e ) { } } return clients ; }
Return all Clients for a profile