Hello World, With Buddies, Buddy Ages and of course Lazy Loading and Identity Map

Setup Tomcat and Eclipse:

Start where you left off with your solution from the Hello World with Updates previous tutorial

Start Eclipse:

eclipse_luna

Use your previous project:

Server should already be set up:

Proxies

  1. The first step is to extract an Interface from your person. Eclipse will do this for you if you right-click in the class, and choose "Extract Interface"
  2. IPerson is the conventional name for the interface of Person, and leave it in the same folder (which is maybe org.soen387.tutorial.dom.model.person if you're thinking ahead)
  3. Now you need to create a Proxy that inherits from IPerson and has an id, innerPerson and getInnerObject method
  4. Look at the notes and talk amongst yourselves to figure out thre rest of the details... but it involves calling the mapper.
  5. Note: You have to decide what to do about Exceptions!!!

Identity Map

  1. As discussed in class, each Data Mapper should have a ThreadLocal Identity Map Associated With it
  2. Your map can just be a HashMap
  3. Make sure to check for all ids in the map before creating a Person
  4. If you do create a Person in the Mapper, remember to add it to the Identity Map

Adding Buddies and Age

  1. If you read through the tutorial before starting and see this, and like a bit of suffering, try to do this step BEFORE you add Identity Map and Lazy Loading
  2. Your list of people should now be in a table
  3. Columns should be, name, age, buddy name, budy age, edit, delete
  4. The delete button should remove that person, as normal
  5. the edit button should take you to a page where you can edit first and last name, age and choose a buddy from a dropdown.
  6. Make sure the dropdown includes a blank field for having no buddy and allows a person to choose themselves as buddy, have a save button that takes you back to the list.
  7. Keep the add person fields/button as normal, but add an age column and a buddy dropdown as per the above.

Note:

You still need that ssh tunnel or a local database. The databse table is the same as from the previous tutorial

Solution:

A solution.