public Client getClient ( int clientId ) throws Exception { Client client = null ; PreparedStatement statement = null ; ResultSet results = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { String queryString = "SELECT * FROM " + Constants . DB_TABLE_CLIENT + " WHERE " + Constants . GENERIC_ID + " = ?" ; statement = sqlConnection . prepareStatement ( queryString ) ; statement . setInt ( 1 , clientId ) ; results = statement . executeQuery ( ) ; if ( results . next ( ) ) { client = this . getClientFromResultSet ( 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 client ; }
Returns a client object for a clientId