[Mailing Lists]
Mailing Lists is a new component of CSNS which you will develop in this quarter. In this assignment you are going to implement the "model" classes and database access for this component, and your design should be based on the following requirements:Name | Description | Owner | Created On | # of Subscribers | Subscribe/Unsubscribe |
csns-announcements | Announcements related to CSNS. | cysun | 03/10/2007 | 20 | - |
cs101-s07 | CS101 Spring 2007 Class Mailing List. | i0001 | 03/22/2007 | 15 | |
j2ee-discussion | Anything related to J2EE development. | s0030 | 02/01/2007 | 30 |
csns-announcements: | |||||||||
|
[Model] (20pt)
Create two Java classes MailingList and Message. Note that in this assignment, you do not need to implement any of the operations described above; however, you must design the classes with proper fields and methods so that these operations can be implemented later. For example, in order to send a message to the subscribers of a mailing list, the MailingList class must keep, at least, the email addresses of the subscribers. Also note that
Compare the pros and cons of the following three class designs:
1. | public class
MailingList { List<Message>
messages; // messages sent to this mailing list
}// other fields and methods ... ... |
public class
Message { MailingList
mailingList; // the mailing list to which this message was sent
}// other fields and methods ... ... |
2. | public class
MailingList { List<Message>
messages; // messages sent to this mailing list
}// other fields and methods ... ... |
public class
Message { // other fields and methods ... ... |
3. | public class
MailingList { // other fields and methods ... ... |
public class
Message { MailingList
mailingList; // the mailing list to which this message was sent
}// other fields and methods ... ... |
[Database Schema] (20pt)
Create Hibernate mapping files for MailingList and Message. Use the hbm2ddl Ant target to generate the database schema into the SQL script file db/csns.ddl. Once you are happy with the database schema, modify db/csns-create.sql accordingly.
Note that to receive full credit for this problem, you must specify proper database integrity constraints (not null, unique, foreign key etc.) in the Hibernate mapping files.
[DOA] (30pt)
Use Hibernate to implement the DAO classes for MailingList and Message. In particular, MailingListDaoImpl must implements the MailingListDao interface, and MessageDaoImpl must implements the MessageDao interface. You may add or remove methods in these interfaces base on your class design.
[Subversion]
Commit all the changes to your Subversion repository, and create a tag called cs520-hw2.