KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > indexcoll > Drawer


1 //$Id: Drawer.java,v 1.1 2005/05/12 13:33:33 epbernard Exp $
2
package org.hibernate.test.annotations.indexcoll;
3
4 import org.hibernate.annotations.IndexColumn;
5
6 import javax.persistence.Entity;
7 import javax.persistence.GeneratorType;
8 import javax.persistence.Id;
9 import javax.persistence.OneToMany;
10 import java.util.List JavaDoc;
11
12 /**
13  * @author Emmanuel Bernard
14  */

15 @Entity
16 public class Drawer {
17     private Long JavaDoc id;
18     private List JavaDoc<Dress> dresses;
19
20     @Id(generate = GeneratorType.AUTO)
21     public Long JavaDoc getId() {
22         return id;
23     }
24
25     public void setId(Long JavaDoc id) {
26         this.id = id;
27     }
28
29     /**
30      * Unidirectional one to many list
31      * @return
32      */

33     @OneToMany
34     @IndexColumn(name="from_bottom_position")
35     public List JavaDoc<Dress> getDresses() {
36         return dresses;
37     }
38
39     public void setDresses(List JavaDoc<Dress> dresses) {
40         this.dresses = dresses;
41     }
42
43     public boolean equals(Object JavaDoc o) {
44         if ( this == o ) return true;
45         if ( !( o instanceof Drawer ) ) return false;
46
47         final Drawer drawer = (Drawer) o;
48
49         if ( !getId().equals( drawer.getId() ) ) return false;
50
51         return true;
52     }
53
54     public int hashCode() {
55         return getId().hashCode();
56     }
57 }
58
Popular Tags