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  	private static final long serialVersionUID = 1L;
15  
16  	@Id @GeneratedValue
17      @Column(name="GUEST_ID")
18      private int id;
19      
20      @Column(name="name", length=60, nullable=false)
21      private String name;
22      
23      public Guest() {}
24      public Guest(int id) {
25          this.id = id;
26      }
27      public Guest(String name) {
28          this.name=name;
29      }
30      
31      public int getId() { return id; }
32  
33      public String getName() { return name; }
34      public void setName(String name) {
35          this.name = name;
36      }
37  
38      @Override
39      public String toString() {
40          StringBuilder builder = new StringBuilder();
41          builder.append("Guest [id=").append(id)
42              .append(", name=").append(name)
43              .append("]");
44          return builder.toString();
45      }
46  }