labs / tiddlers / content / labs / lab07 / _Labs_07_Complete the getScientists
  1. Take a look at the getScientist method. This is the method that queries the database to find the scientists and then converts the query result into Scientist objects.

    There is no placeholders in the SQL statement this time so we don't need to provide any values to this statement.

  2. Read through the code for this method --- the comments explain what each line of code is doing.

    The query returns a ResultSet object that effectively looks like the table results that you see when you run a query in DBeaver.

    To process the result and turn it into Scientist objects, we loop through the rows in the result set and extract the values for each column using the column name.

    These values can be used to create the Scientist object.

  3. There is currently a block comment that was added to stop compiler errors from breaking the priming build. You should remove this comment by deleting lines 67 and 90.

  4. Again, the code for handling the email and mobile phone is missing.

    Using the existing code as an example, refer to the ERD below to find the column names and extract the value for the email and mobile phone from the result set.

    <> PostgreSQL returns the column names in the result set in lowercase (it is one of the more annoying quirks of PostgreSQL considering pretty much every other DBMS uses uppercase) --- you will need to use lowercase for the column names when extracting the values.