View Javadoc
1   package info.ejava.examples.ejb.ejbjpa.bo;
2   
3   import java.io.Serializable;
4   
5   import javax.persistence.Column;
6   import javax.persistence.Entity;
7   import javax.persistence.GeneratedValue;
8   import javax.persistence.Id;
9   import javax.persistence.Table;
10  
11  @Entity
12  @Table(name="EJBJPA_GUEST")
13  public class Guest implements Serializable {
14      @Id @GeneratedValue
15      @Column(name="GUEST_ID")
16      private int id;
17      
18      @Column(name="name", length=60, nullable=false)
19      private String name;
20      
21      public Guest() {}
22      public Guest(int id) {
23          this.id = id;
24      }
25      public Guest(String name) {
26          this.name=name;
27      }
28      
29      public int getId() { return id; }
30  
31      public String getName() { return name; }
32      public void setName(String name) {
33          this.name = name;
34      }
35  
36      @Override
37      public String toString() {
38          StringBuilder builder = new StringBuilder();
39          builder.append("Guest [id=").append(id)
40              .append(", name=").append(name)
41              .append("]");
42          return builder.toString();
43      }
44  }