KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > referencedcolumnname > Clothes


1 //$Id: Clothes.java,v 1.1 2005/07/22 02:33:21 epbernard Exp $
2
package org.hibernate.test.annotations.referencedcolumnname;
3
4 import javax.persistence.Entity;
5 import javax.persistence.Id;
6 import javax.persistence.GeneratorType;
7
8 /**
9  * @author Emmanuel Bernard
10  */

11 @Entity
12 public class Clothes {
13     private Integer JavaDoc id;
14     private String JavaDoc type;
15     private String JavaDoc flavor;
16
17     public Clothes() {
18     }
19
20     public Clothes(String JavaDoc type, String JavaDoc flavor) {
21         this.type = type;
22         this.flavor = flavor;
23     }
24
25     @Id(generate = GeneratorType.AUTO)
26     public Integer JavaDoc getId() {
27         return id;
28     }
29
30     public void setId(Integer JavaDoc id) {
31         this.id = id;
32     }
33
34     public String JavaDoc getType() {
35         return type;
36     }
37
38     public void setType(String JavaDoc type) {
39         this.type = type;
40     }
41
42     public String JavaDoc getFlavor() {
43         return flavor;
44     }
45
46     public void setFlavor(String JavaDoc flavor) {
47         this.flavor = flavor;
48     }
49
50     public boolean equals(Object JavaDoc o) {
51         if ( this == o ) return true;
52         if ( !( o instanceof Clothes ) ) return false;
53
54         final Clothes clothes = (Clothes) o;
55
56         if ( !flavor.equals( clothes.flavor ) ) return false;
57         if ( !type.equals( clothes.type ) ) return false;
58
59         return true;
60     }
61
62     public int hashCode() {
63         int result;
64         result = type.hashCode();
65         result = 29 * result + flavor.hashCode();
66         return result;
67     }
68 }
69
Popular Tags