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 java.io.Serializable;
022: import java.math.BigInteger;
023: import java.util.HashMap;
024: import java.util.HashSet;
025: import java.util.Map;
026: import java.util.Set;
027: import java.util.TreeMap;
028: import javax.persistence.Basic;
029: import javax.persistence.CascadeType;
030: import javax.persistence.Column;
031: import javax.persistence.Embedded;
032: import javax.persistence.Entity;
033: import javax.persistence.GeneratedValue;
034: import javax.persistence.GenerationType;
035: import javax.persistence.Id;
036: import javax.persistence.ManyToMany;
037: import javax.persistence.ManyToOne;
038:
039: import org.apache.openjpa.persistence.jdbc.KeyColumn;
040: import org.apache.openjpa.persistence.FetchAttribute;
041: import org.apache.openjpa.persistence.FetchGroup;
042: import org.apache.openjpa.persistence.FetchGroups;
043: import org.apache.openjpa.persistence.PersistentMap;
044: import org.apache.openjpa.persistence.jdbc.KeyColumn;
045:
046: @Entity
047: @FetchGroups({@FetchGroup(name="all",attributes={@FetchAttribute(name="bs",recursionDepth=0),@FetchAttribute(name="pcStringMap"),@FetchAttribute(name="bigIntegerPCMap",recursionDepth=0),@FetchAttribute(name="embeddedE",recursionDepth=0),@FetchAttribute(name="embeddedA",recursionDepth=0)})})
048: public class AttachD implements Serializable {
049:
050: @Id
051: @GeneratedValue(strategy=GenerationType.AUTO)
052: @Column(name="D_ID")
053: private int id;
054:
055: private Object version;
056:
057: @Basic
058: private String dstr;
059: @Basic
060: private int dint;
061: @Basic
062: private double ddbl;
063:
064: @ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE})
065: private AttachA a;
066:
067: @ManyToMany(mappedBy="ds",cascade={CascadeType.PERSIST,CascadeType.MERGE})
068: private Set<AttachB> bs = new HashSet();
069:
070: @PersistentMap(keyCascade={CascadeType.PERSIST,CascadeType.MERGE})
071: @KeyColumn(name="strngmap")
072: private Map<AttachA, String> pcStringMap = new HashMap();
073:
074: @PersistentMap(elementCascade={CascadeType.PERSIST,CascadeType.MERGE})
075: @KeyColumn(name="intmap")
076: private TreeMap<BigInteger, AttachF> bigIntegerPCMap = new TreeMap<BigInteger, AttachF>();
077:
078: @Embedded
079: private AttachE embeddedE;
080:
081: @Embedded
082: private AttachA embeddedA;
083:
084: public int getId() {
085: return id;
086: }
087:
088: public void setDstr(String dstr) {
089: this .dstr = dstr;
090: }
091:
092: public String getDstr() {
093: return this .dstr;
094: }
095:
096: public void setDint(int dint) {
097: this .dint = dint;
098: }
099:
100: public int getDint() {
101: return this .dint;
102: }
103:
104: public void setDdbl(double ddbl) {
105: this .ddbl = ddbl;
106: }
107:
108: public double getDdbl() {
109: return this .ddbl;
110: }
111:
112: public AttachA getA() {
113: return a;
114: }
115:
116: public void setA(AttachA a) {
117: this .a = a;
118: }
119:
120: public void setBs(Set bs) {
121: this .bs = bs;
122: }
123:
124: public Set getBs() {
125: return this .bs;
126: }
127:
128: public void setPcStringMap(Map pcStringMap) {
129: this .pcStringMap = pcStringMap;
130: }
131:
132: public Map getPcStringMap() {
133: return this .pcStringMap;
134: }
135:
136: public void setBigIntegerPCMap(TreeMap bigIntegerPCMap) {
137: this .bigIntegerPCMap = bigIntegerPCMap;
138: }
139:
140: public TreeMap getBigIntegerPCMap() {
141: return this .bigIntegerPCMap;
142: }
143:
144: public void setEmbeddedE(AttachE embeddedE) {
145: this .embeddedE = embeddedE;
146: }
147:
148: public AttachE getEmbeddedE() {
149: return this .embeddedE;
150: }
151:
152: public void setEmbeddedA(AttachA embeddedA) {
153: this .embeddedA = embeddedA;
154: }
155:
156: public AttachA getEmbeddedA() {
157: return this .embeddedA;
158: }
159:
160: public Object getVersion() {
161: return this.version;
162: }
163: }
|