Getting courses from database tables using JDBC

We will now modify listCourses.jsp to display the courses that we have added using addCourse.jsp. However, we first need to add a method in CourseDAO to get all courses from the database.

Note that the Course table has a one-to-many relationship with Teacher. It stores the teacher ID in it. Further, the teacher ID is not a required field, so a course can exist in the Course table with null teacher_id. To get all the details of a course, we need to get the teacher for the course too. However, we cannot create a simple join in an SQL query to get the details of a course and of the teacher for each course, because a teacher may not have been set for the course. In such cases, we use the left outer ...

Get Java EE 8 Development with Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.