Handouts and Solutions for

06-18156.2 Internet Computing Workshop: Sem2


Demonstrators

Our three demonstrators are: Adedayo (Dayo) Adetoye and Cong lun Yao and Huan Huan Chen

Their office hours are

Day
Time
Room
Demonstrator
Tuesdays
14:00-15:00
218 Huan Huan
Tuesdays
16:00-18:00
145 Cong lun
Wednesdays
13:00-14:00
218 Dayo

For office hours, you can bring your laptop in to show your work or just printouts if you like. Otherwise, they may want to go down to the lab with you if they can't solve the problem away from the computers. If so, they will leave a notice on their desks saying that they can be found in the lab.


Tutorial And Lab Classes

There will be a tutorial each week, given by the demonstrators. Sometimes these will be prepared lessons, sometimes they will just be lab sessions.

Day
Time
Room
Type
Wednesdays
09:00-11:00
LG04 Lab session: don't miss two in a row
Thursdays
15:00-16:00
LG04 Tutorial

Handouts

Handouts are available from the school library from the box in the shelves. The librarian always has a master copy so if they run out from the shelf box, ask the librarian to run off extra copies.

Handout 1: JDBC

This covers use of JDBC, using transactions via JDBC and describes the "Shop" database and the exercises. There are links to the files used for the exercise in the handout.

For Postgresql, the school has copies of the online manuals here, and some further documentation about the school installations of Postgresql here. If you have forgotten your postgresql password, you can reset it here.

Handout 2: Use Cases

This handout discusses Use Cases, a basic specification document form.

Handout 3: Hibernate

This handout introduces Hibernate, an object-relational mapping tool.

Spring

The first step is to get your Spring configuration working and to experiment with the following simple Spring application: SimpleSpring.jar

Assessed Exercises

This exercise is only available from within the school network or if you tunnel in to the school network from outside using the school's webcache proxy

Assessment 1: Car Rental Booking JDBC

Assessment 2: Car Rental Booking Hibernate

Assessment 3: Car Rental Spring Hibernate

Assessment 4: Car Rental Tapestry

Assessment 5: Car Rental Integration


Solutions to Exercises

Solution 1: AddBooking.java

What I was looking for in this exercise was a clear understanding of the basic JDBC mechanisms and transactions and the ability to turn a Use Case into the corresponding sequence of JDBC calls. One item that came up: A number of students wrote quite large amounts of code where much smaller amounts would have been satisfactory. The aim should always be to keep your code simple and readable so that it can be easily understood and maintained.

Solution 2: CarRentalHib.jar

Here I have given a solution using Hibernate that matches very closely to the JDBC solution in structure. However, we can take advantage of the more object oriented approach that Hibernate provides to make things significantly simpler - once we have gotten our heads around the issues of mapping the relationship in the .hbm.xml files. A DAO based solution would have been possible, but still rather clumsy in Hibernate alone because of the need to provide access to a Hibernate session in each DAO implementation. There is a standard Hibernate pattern for this: the ThreadLocal Hibernate Utilities class, but we won't dive into that because Spring provides a much better and more convenient solution, which we will quickly move on to...


Alan P Sexton