View Javadoc
1   package myorg.entitymgrex;
2   
3   import java.io.Serializable;
4   
5   import javax.persistence.Entity;
6   import javax.persistence.GenerationType;
7   import javax.persistence.GeneratedValue;
8   import javax.persistence.Id;
9   import javax.persistence.Table;
10  
11  @Entity @Table(name="EM_AUTO")
12  public class Auto implements Serializable {
13      private static final long serialVersionUID = 1L;
14      @Id @GeneratedValue(strategy=GenerationType.IDENTITY)
15      private long id;
16      private String make;
17      private String model;
18      private String color;
19      private int mileage;
20  
21      public Auto(){}
22      public Auto(int id) { this.id=id; }
23      public long getId() { return id; }
24  
25      //more getter/setters go here
26      public String getMake() { return make; }
27      public void setMake(String make) {
28          this.make = make;
29      }
30      
31      public int getMileage() { return mileage; }
32      public void setMileage(int mileage) {
33          this.mileage = mileage;
34      }
35      
36      public String getModel() { return model; }
37      public void setModel(String model) {
38          this.model = model;
39      }
40      
41      public String getColor() { return color; }
42      public void setColor(String color) {
43          this.color = color;
44      }    
45  
46      @Override
47      public String toString() {
48          StringBuilder builder = new StringBuilder();
49          builder
50              .append("id=").append(id)
51              .append(", make=").append(make)
52              .append(", model=").append(model)
53              .append(", color=").append(color)
54              .append(", mileage=").append(mileage);
55          return builder.toString();
56      }    
57  }