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.math.BigInteger;
022: import java.util.Date;
023: import javax.persistence.Basic;
024: import javax.persistence.CascadeType;
025: import javax.persistence.Entity;
026: import javax.persistence.FetchType;
027: import javax.persistence.GeneratedValue;
028: import javax.persistence.GenerationType;
029: import javax.persistence.Id;
030: import javax.persistence.OneToOne;
031: import javax.persistence.Table;
032: import javax.persistence.Temporal;
033: import javax.persistence.TemporalType;
034:
035: import org.apache.openjpa.persistence.FetchAttribute;
036: import org.apache.openjpa.persistence.FetchGroup;
037: import org.apache.openjpa.persistence.FetchGroups;
038: import org.apache.openjpa.persistence.LoadFetchGroup;
039:
040: @Entity
041: @Table(name="FETCH_GRP_TOBJ")
042: @FetchGroups({@FetchGroup(name="g1",attributes={@FetchAttribute(name="b"),@FetchAttribute(name="c"),@FetchAttribute(name="d")}),@FetchGroup(name="g2",attributes={@FetchAttribute(name="e"),@FetchAttribute(name="f"),@FetchAttribute(name="g")})})
043: public class FetchGroupTestObject {
044:
045: @Id
046: @GeneratedValue(strategy=GenerationType.AUTO)
047: private int id;
048:
049: private int a;
050:
051: @Basic(fetch=FetchType.LAZY)
052: @LoadFetchGroup("g1")
053: private String b;
054:
055: @Basic(fetch=FetchType.LAZY)
056: @LoadFetchGroup("g1")
057: private BigInteger c;
058:
059: @Basic(fetch=FetchType.LAZY)
060: @LoadFetchGroup("g1")
061: @Temporal(TemporalType.DATE)
062: private Date d;
063:
064: @Basic(fetch=FetchType.LAZY)
065: @LoadFetchGroup("g2")
066: private String e;
067:
068: @Basic(fetch=FetchType.LAZY)
069: @LoadFetchGroup("g2")
070: private String f;
071:
072: @OneToOne(cascade={CascadeType.PERSIST},fetch=FetchType.LAZY)
073: @LoadFetchGroup("g2")
074: private FetchGroupTestObject g;
075:
076: @OneToOne(cascade={CascadeType.PERSIST})
077: private FetchGroupTestObject h;
078:
079: public int getId() {
080: return this .id;
081: }
082:
083: public void setA(int val) {
084: a = val;
085: }
086:
087: public int getA() {
088: return a;
089: }
090:
091: public void setB(String val) {
092: b = val;
093: }
094:
095: public String getB() {
096: return b;
097: }
098:
099: public void setC(BigInteger val) {
100: c = val;
101: }
102:
103: public BigInteger getC() {
104: return c;
105: }
106:
107: public void setD(Date val) {
108: d = val;
109: }
110:
111: public Date getD() {
112: return d;
113: }
114:
115: public void setE(String val) {
116: e = val;
117: }
118:
119: public String getE() {
120: return e;
121: }
122:
123: public void setF(String val) {
124: f = val;
125: }
126:
127: public String getF() {
128: return f;
129: }
130:
131: public void setG(FetchGroupTestObject val) {
132: g = val;
133: }
134:
135: public FetchGroupTestObject getG() {
136: return g;
137: }
138:
139: public void setH(FetchGroupTestObject val) {
140: h = val;
141: }
142:
143: public FetchGroupTestObject getH() {
144: return h;
145: }
146: }
|