01: package example;
02:
03: import javax.persistence.Column;
04: import javax.persistence.Entity;
05: import javax.persistence.GeneratedValue;
06: import javax.persistence.Id;
07: import javax.persistence.Table;
08:
09: @Entity
10: @Table(name="categories")
11: public class Category {
12: @Id
13: @GeneratedValue
14: private int id;
15:
16: @Column(unique=true,nullable=false)
17: private String name;
18:
19: public void setTitle(String name) {
20: this .name = name;
21: }
22:
23: public int getId() {
24: return id;
25: }
26:
27: public String getName() {
28: return name;
29: }
30:
31: public void setName(String name) {
32: this .name = name;
33: }
34:
35: public String toString() {
36: return getClass().getSimpleName() + "[id=" + id + " name="
37: + name + "]";
38: }
39: }
|