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.jdbc.common.apps;
020:
021: import org.apache.openjpa.kernel.*;
022:
023: import java.util.*;
024: import java.io.*;
025:
026: import javax.persistence.Entity;
027: import javax.persistence.Id;
028: import java.lang.annotation.Annotation;
029:
030: @Entity
031: public class AttachA implements Serializable, PreDetachCallback,
032: PostDetachCallback, PreAttachCallback, PostAttachCallback {
033:
034: // transient method for testing callbacks
035: public transient Object detachSource = null;
036: public transient Object attachSource = null;
037: public transient int preAttachCalls = 0;
038: public transient int postAttachCalls = 0;
039: public transient int preDetachCalls = 0;
040: public transient int postDetachCalls = 0;
041:
042: private String astr;
043: private int aint;
044: private double adbl;
045: private String[] stringArray = new String[0];
046: private AttachE[] attachEArray = new AttachE[0];
047:
048: public void jdoPreDetach() {
049: preDetachCalls++;
050: }
051:
052: public void jdoPostDetach(Object orig) {
053: postDetachCalls++;
054: detachSource = orig;
055: }
056:
057: public void jdoPreAttach() {
058: preAttachCalls++;
059: }
060:
061: public void jdoPostAttach(Object orig) {
062: postAttachCalls++;
063: attachSource = orig;
064: }
065:
066: public void setAstr(String astr) {
067: this .astr = astr;
068: }
069:
070: public String getAstr() {
071: return this .astr;
072: }
073:
074: public void setAint(int aint) {
075: this .aint = aint;
076: }
077:
078: public int getAint() {
079: return this .aint;
080: }
081:
082: public void setAdbl(double adbl) {
083: this .adbl = adbl;
084: }
085:
086: public double getAdbl() {
087: return this .adbl;
088: }
089:
090: public void setStringArray(String[] stringArray) {
091: this .stringArray = stringArray;
092: }
093:
094: public String[] getStringArray() {
095: return this .stringArray;
096: }
097:
098: public void setAttachEArray(AttachE[] attachEArray) {
099: this .attachEArray = attachEArray;
100: }
101:
102: public AttachE[] getAttachEArray() {
103: return this .attachEArray;
104: }
105:
106: private void writeObject(ObjectOutputStream out) throws IOException {
107: out.defaultWriteObject();
108: }
109:
110: private void readObject(ObjectInputStream in) throws IOException,
111: ClassNotFoundException {
112: in.defaultReadObject();
113: }
114: }
|