28 CHAPTER 1: Introducing Java Web Development
Listing 1-6. Model: Author
package com.apress.books.model;
public class Author {
private Long id;
private Long bookId;
private String firstName;
private String lastName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String toString() {
return "Author - Id: " + id + ", Book id: " + bookId + ", First Name: "
- firstName + ", Last Name: " +lastName;
}
}
Now let’s start with a simple interface for BookDAO that encapsulates all the data access by your web
application. Listing 1-7 shows the BookDAO interface.