O'Reilly logo

MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL by James Turner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Author Object

The Product object makes use of the Author object because a product has a reference to the authors of the book. So, you need to implement the Author object now as well. The Author object, by the way, is extremely simple, as Listing 9.7 shows.

Listing 9.7. Author.Java
 package com.bfg.product; import java.util.Vector; import java.util.HashMap; public class Author { protected static HashMap authors = new HashMap(); protected Vector pBooks = new Vector(); protected String pName; public Vector getBooks() { return pBooks; } public void setBooks(Vector Books) { pBooks = Books; } public String getName() { return pName; } public void setName(String Name) { pName = Name; } public static Author findAuthor(String name) { if (authors.get(name) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required