Homework 3
CS520, Fall 2012


Due: Thursday, October 18

Package all the source files of your project into a zip file as you did in Homework 1 and upload the zip file to CSNS. In addition to the zip file, also upload a text file hw3.txt which lists all the Java class you have created or modified. Note that file uploading will be disabled automatically after 11:59PM of the due date, so please turn in your work on time.


[Readings]

[Project Listings in CSNS2]

This quarter you are going to add senior design project listing support to CSNS2. It is similar to the project listing on CSNS but with a lot more features.

[Model and ORM] (40pt)

Create new model classes and/or modify existing ones and map them to a relational schema using JPA annotations based on the following requirements:

A project is conducted by a group of students and is supervised by one or more faculty advisors. A project has a name, a description, and a number of resources. A resource has a name,  and contains either a URL, a piece of text, or a file. We will refer to a resource as a URL resource, or a text resource, or a file resource depending on its content. Each project must have at least one file resource: Project Documentation.

Each department has their own project listing, and projects will be displayed by year as opposed to by quarter like the current CSNS project listing.

Run the Hbm2ddl program in CSNS2 to generate a new src/main/scripts/csns.ddl file and check if the database schema is what you expect.

[Database Scripts] (20pt)

Based on the csns.ddl file generated in the previous exercise, modify the following database scripts to add the project listing support:

Read the database script src/main/scripts/csns-test-insert.sql, understand what it does, and modify the script as follows:

[Data Access] (20pt)

Add ProjectDao to the csns.model.academics.dao package and ProjectDaoImpl to the csns.model.academics.dao.jpa package. Use existing DaoImpl classes as examples to complete the methods in ProjectDaoImpl.

[Testing]

Place ProjectDaoTest in the package csns.model.academics.dao under src/test/java. Run the test code by using either mvn test, or in Eclipse, right click on testng.xml under src/test/resources and select Run As -> TestNG Suite. In either case you should not see any errors. Note that you may not change the test code.

[Subversion]

Commit all the changes to your Subversion repository, and create a tag called cs520-hw3.