01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.apache.openejb.core.cmp.jpa;
18:
19: import javax.persistence.Column;
20: import javax.persistence.Embeddable;
21:
22: @Embeddable
23: public class EmbeddedBillPk {
24: private long billNumber;
25: private long billVersion;
26: private long billRevision;
27:
28: public EmbeddedBillPk() {
29:
30: }
31:
32: public EmbeddedBillPk(long number, long version, long revision) {
33: this .billNumber = number;
34: this .billVersion = version;
35: this .billRevision = revision;
36: }
37:
38: @Column(name="billNumber")
39: public long getBillNumber() {
40: return this .billNumber;
41: }
42:
43: public void setBillNumber(long number) {
44: this .billNumber = number;
45: }
46:
47: @Column(name="billVersion")
48: public long getBillVersion() {
49: return this .billVersion;
50: }
51:
52: public void setBillVersion(long version) {
53: this .billVersion = version;
54: }
55:
56: @Column(name="billRevision")
57: public long getBillRevision() {
58: return this .billRevision;
59: }
60:
61: public void setBillRevision(long revision) {
62: this .billRevision = revision;
63: }
64:
65: public boolean equals(Object obj) {
66: if (obj == this )
67: return true;
68:
69: if (!(obj instanceof EmbeddedBillPk))
70: return false;
71:
72: EmbeddedBillPk pk = (EmbeddedBillPk) obj;
73:
74: if (billNumber != pk.billNumber)
75: return false;
76:
77: if (billVersion != pk.billVersion)
78: return false;
79:
80: if (billRevision != pk.billRevision)
81: return false;
82:
83: return true;
84: }
85:
86: public int hashCode() {
87: return (billNumber + "." + billVersion + "." + billRevision)
88: .hashCode();
89: }
90: }
|