schema.sql
EventsDAOImpl.java
under mysql packageEvents related Servlet
changes- Single txt submission containing link to the pull request and cs 3 application
In this lab, we first implement the DAO by using JDBC under mysql package. Then, we refactor out the existing usage of the DAO to use MySQL instead of using application scope DAO.
The functionality should remain unchanged while refactoring.
You may find the starter code from the release: https://github.com/rcliao/cookie-clicker/releases/tag/lab-7-2
In specific, you will need to create/overwrite the following files:
src/main/java/edu/csula/storage/Database.java
src/main/java/edu/csula/storage/mysql/Database.java
src/main/java/edu/csula/storage/mysql/EventsDAOImpl.java
src/test/java/edu/csula/storage/mysql/EventsDAOImplTest.java
At the end of this lab, your application should be reading data from MySQL rather than from memory (application scope). This implies that all the data you create in the application should be persistent across the server restart.
To do so, following items may be useful to get you started:
- Create
schema.sql
that defines table schemas and insert sample data - Change the
*Query
String variables under EventsDAOImpl - Implement each method under EventsDAOImpl until passing all unit tests
- Execute
schema.sql
against the database you are connecting with (local and CS3) - Refactor the DAO usages from the Servlet (controller layer)
- Test to ensure the functionalities remain the same
- Application should remain the same as before
- Data should be read from database
- Should pass all unit tests
- Should utilize the DAO under mysql package throughout the Servlets