Project Lab 3: JDBC in Spring
Objective
Your assignment in this lab is to implement the MoviesDao interface in JDBC using Spring. The goal is that you understand
how to implement persistence in Java using the Spring Framework. Hopefully you will come to see that this can be done in
a methodical and fairly simple fashion.
Allowable collaboration
You will be working on this lab in your project teams. I will expect each team to turn in a separate solution, and that you will not collaborate between groups.
Getting started
I am providing you a starting point for this project with the zip file Movies.zip, which you should download somewhere. Following are step-by-step instructions for doing that:
- Assuming you have downloaded and unzipped the file, one of you should go into MyEclipse to import it into their workspace. Do this by right-clicking on the white space in the Package Explorer and choosing "Import...". In the pop-up window, select "General > Existing Projects into Workspace" and click Next. Check the box that says "Copy projects into workspace" and browse to find the Movies directory that was unzipped (not the zip file). Once you click finish, you should see Movies in your Project Explorer. Don't try running it yet.
- Hopefully, everything is now there. However, you are not ready to run the app. You should first re-install the movies database using the dropTables.sql, createTables.sal, and loadInitialData.sql files. This needs to be done, since I have changed the definitions slightly. Take a moment to look at createTables,sql, and see qhat is different. Note also that I changed movies.dat, since I reordered the fields in the movies table.
- You should now change the parameters in applicationContext.xml to correspond to your database on mcs-mysql.gac.edu. Once you do this, you should be able to run the app, which is movies.app.MovieApp. Do so, and see what happened.
- Now you can start on the project. Basically, you should implement the methods that have been commented out in the interface file movies.dao.MoviesDao. The implementations should go in movies.dao.MoviesDaoJdbc, of course. Take a time to peruse around the project and see how it is put together.
After you unzip it, you can then import it into your MyEclipse workspace
(I will help you with this in lab). Browse around this project; it should be fairly self-explanatory. Your task is to
implement the methods that I commented out in the interface MoviesDao.java in the java class MoviesDaoJdbc.java.
This will involve other things as well (e.g., filling out Store.java and Dvd.java). You should also test the methods
you write in the testing class MovieApp.java.
Note that I change the table definitions of movies in createTable.sql.
Documentation comments
I will expect good documentation comments. As I said to many of you in my comments when I graded project lab 2, your comments should clearly (and concisely) describe what the methods do and return from the perspective of the client. In particular, most of these comments will be in the interface file MoviesDao, which should be agnostic to the particular persistence mechanism (in your case JDBC) that is used, as well as the corresponding data file movie.data. I also changed the other tables as well so that they automatically increment the id on all tables, so you will be much better off working from the schemata I provide.
What to hand in
Please export your finished project in a zip file and email it to me.