KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > cid > Parent


1 //$Id: Parent.java,v 1.1 2005/05/12 13:33:26 epbernard Exp $
2
package org.hibernate.test.annotations.cid;
3
4 import javax.persistence.AccessType;
5 import javax.persistence.EmbeddedId;
6 import javax.persistence.Entity;
7
8 /**
9  * Entity with composite id
10  * @author Emmanuel Bernard
11  */

12 @Entity(access=AccessType.FIELD)
13 public class Parent {
14     @EmbeddedId
15     public ParentPk id;
16
17     public boolean equals(Object JavaDoc o) {
18         if (this == o) return true;
19         if (!(o instanceof Parent)) return false;
20
21         final Parent parent = (Parent) o;
22
23         if (!id.equals(parent.id)) return false;
24
25         return true;
26     }
27
28     public int hashCode() {
29         return id.hashCode();
30     }
31 }
32
Popular Tags