KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > ejb > test > Distributor


1 //$Id: Distributor.java,v 1.2 2005/07/09 20:04:44 epbernard Exp $
2
package org.hibernate.ejb.test;
3
4 import javax.persistence.Entity;
5 import javax.persistence.GeneratorType;
6 import javax.persistence.Id;
7
8 /**
9  * @author Emmanuel Bernard
10  */

11 @Entity
12         public class Distributor {
13     private Integer JavaDoc id;
14     private String JavaDoc name;
15
16     @Id(generate = GeneratorType.AUTO)
17             public Integer JavaDoc getId() {
18         return id;
19     }
20
21     public void setId(Integer JavaDoc id) {
22         this.id = id;
23     }
24
25     public String JavaDoc getName() {
26         return name;
27     }
28
29     public void setName(String JavaDoc name) {
30         this.name = name;
31     }
32
33     public boolean equals(Object JavaDoc o) {
34         if ( this == o ) return true;
35         if ( !( o instanceof Distributor ) ) return false;
36
37         final Distributor distributor = (Distributor) o;
38
39         if ( !name.equals( distributor.name ) ) return false;
40
41         return true;
42     }
43
44     public int hashCode() {
45         return name.hashCode();
46     }
47 }
48
Popular Tags