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 java.io.*;
022: import java.math.*;
023: import java.util.*;
024:
025: import javax.persistence.CascadeType;
026: import javax.persistence.Column;
027: import javax.persistence.Entity;
028: import javax.persistence.FetchType;
029: import javax.persistence.GeneratedValue;
030: import javax.persistence.Id;
031: import javax.persistence.Inheritance;
032: import javax.persistence.InheritanceType;
033: import javax.persistence.OneToMany;
034: import javax.persistence.OneToOne;
035: import javax.persistence.Table;
036: import javax.persistence.Transient;
037:
038: /**
039: * <p>Persitent type used in testing.</p>
040: *
041: * @author Abe White
042: */
043: @Entity
044: @Table(name="rtest1")
045: @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
046: public class RuntimeTest1 implements Serializable {
047:
048: private static final long serialVersionUID = 1L;
049:
050: @Transient
051: public static final String someStaticField = "someField";
052:
053: private Locale localeField;
054:
055: @Id
056: private int intField;
057:
058: @Column(length=35)
059: private String stringField;
060:
061: // transactional only
062: @Column(length=35)
063: public String transString;
064:
065: // relations
066: //@Transient
067: @OneToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST,CascadeType.REMOVE})
068: private RuntimeTest1 selfOneOne;
069:
070: @Transient
071: private Set selfOneMany = new HashSet();
072:
073: public RuntimeTest1() {
074: }
075:
076: public RuntimeTest1(int key) {
077: this .intField = key;
078: }
079:
080: public RuntimeTest1(String str, int i) {
081: stringField = str;
082: intField = i;
083: }
084:
085: public int getIntField() {
086: return this .intField;
087: }
088:
089: public void setIntField(int intField) {
090: this .intField = intField;
091: }
092:
093: public String getStringField() {
094: return this .stringField;
095: }
096:
097: public void setStringField(String stringField) {
098: this .stringField = stringField;
099: }
100:
101: public RuntimeTest1 getSelfOneOne() {
102: return this .selfOneOne;
103: }
104:
105: public void setSelfOneOne(RuntimeTest1 selfOneOne) {
106: this .selfOneOne = selfOneOne;
107: }
108:
109: public Set getSelfOneMany() {
110: return this .selfOneMany;
111: }
112:
113: public void setSelfOneMany(Set selfOneMany) {
114: this .selfOneMany = selfOneMany;
115: }
116:
117: public String toString() {
118: return "IntField: " + intField + ", StringField: "
119: + stringField + " .";
120: }
121:
122: public Locale getLocaleField() {
123: return localeField;
124: }
125:
126: public void setLocaleField(Locale localeField) {
127: this.localeField = localeField;
128: }
129: }
|