001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */
019: package org.apache.openjpa.persistence.kernel.common.apps;
020:
021: import javax.persistence.Entity;
022:
023: /**
024: * Concrete subclass that defines two more primary key fields than its
025: * abstract superclass.
026: *
027: * @author <a href="mailto:marc@solarmetric.com">Marc Prud'hommeaux</a>
028: */
029: @Entity
030: public class AppIdSubC extends AppIdSubB {
031:
032: private long pk1c;
033: private String pk2c;
034: private String stringFieldC;
035:
036: public void setPk1c(long pk1c) {
037: this .pk1c = pk1c;
038: }
039:
040: public long getPk1c() {
041: return this .pk1c;
042: }
043:
044: public void setPk2c(String pk2c) {
045: this .pk2c = pk2c;
046: }
047:
048: public String getPk2c() {
049: return this .pk2c;
050: }
051:
052: public void setStringFieldC(String stringFieldC) {
053: this .stringFieldC = stringFieldC;
054: }
055:
056: public String getStringFieldC() {
057: return this .stringFieldC;
058: }
059:
060: /*
061: public static class ID
062: extends AppIdSubB.ID
063: {
064: private long pk1c;
065: private String pk2c;
066:
067:
068: public ID ()
069: {
070: super ();
071: }
072:
073:
074: public ID (String str)
075: {
076: super ();
077: fromString (str);
078: }
079:
080:
081: public int hashCode ()
082: {
083: return (int)((super.hashCode () + pk1c
084: + (pk2c == null ? 0 : pk2c.hashCode ())) % Integer.MAX_VALUE);
085: }
086:
087:
088: public boolean equals (Object other)
089: {
090: return super.equals (other)
091: && ((ID)other).pk1c == pk1c
092: && ((ID)other).pk2c == null ? pk2c == null
093: : ((ID)other).pk2c.equals (pk2c);
094: }
095:
096:
097: public String toString ()
098: {
099: return super.toString () + DELIMITER + pk1c + DELIMITER + pk2c;
100: }
101:
102:
103: StringTokenizer fromString (String idString)
104: {
105: StringTokenizer tok = super.fromString (idString);
106: pk1c = new Long (tok.nextToken ()).longValue ();
107: pk2c = tok.nextToken ();
108: return tok; // return the tokenizer for subclasses to use
109: }
110: }
111: */
112: }
|