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