View Javadoc
1   package ejava.examples.daoex.bo;
2   
3   /**
4    * This is an example entity class that will get mapped into the database 
5    * using a DAO. Note that the id carries the primary key and should not be 
6    * modified after the object is created. This is why setId() is set to private.
7    */
8   public class Book  {
9       private long id;
10      private String title;
11      private int pages;
12      private String description;
13      
14      public Book() {}
15      public Book(long id) { this.id = id; }
16      
17      public long getId() { return id; }
18      
19      public String getDescription() { return description; }
20      public void setDescription(String description) {
21          this.description = description;
22      }
23      
24      public int getPages() { return pages; }
25      public void setPages(int pages) {
26          this.pages = pages;
27      }
28      
29      public String getTitle() { return title; }
30      public void setTitle(String title) {
31          this.title = title;
32      }
33  
34      public String toString() {
35          StringBuilder text = new StringBuilder();
36          text.append("id=").append(id);
37          text.append(", title=").append(title);
38          text.append(", pages=").append(pages);
39          return text.toString();
40      }
41  }