01: package org.apache.ojb.broker;
02:
03: import org.apache.ojb.broker.Identity;
04:
05: /**
06: * This is a Primary Key Class for Article class
07: **/
08: public class ArticlePrimaryKey implements java.io.Serializable {
09:
10: int id;
11:
12: /**
13: * PlzEntryBmpKey(String key) constructor
14: */
15: public ArticlePrimaryKey(int key) {
16: //oid = new PlzEntryIdentity(key);
17: id = key;
18:
19: }
20:
21: /**
22: * equals method
23: * - user must provide a proper implementation for the equal method. The generated
24: * method assumes the key is a String object.
25: */
26: public boolean equals(Object o) {
27: if (o instanceof ArticlePrimaryKey)
28: return (id == ((ArticlePrimaryKey) o).id);
29: else
30: return false;
31: }
32:
33: /**
34: * hashcode method
35: * - user must provide a proper implementation for the hashCode method. The generated
36: * method assumes the key is a String object.
37: */
38: public int hashCode() {
39: return id;
40: }
41:
42: /**
43: * PlzEntryBmpKey(String key) constructor
44: */
45: public ArticlePrimaryKey(Identity oid) {
46:
47: id = ((Integer) oid.getPrimaryKeyValues()[0]).intValue();
48:
49: }
50: }
|