01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.persistence.kernel.common.apps;
20:
21: import java.io.Serializable;
22: import java.util.HashSet;
23: import java.util.Set;
24: import javax.persistence.Basic;
25: import javax.persistence.CascadeType;
26: import javax.persistence.Column;
27: import javax.persistence.Entity;
28: import javax.persistence.FetchType;
29: import javax.persistence.Id;
30: import javax.persistence.OneToOne;
31: import javax.persistence.Table;
32:
33: @Entity
34: @Table(name="holder")
35: public class InterfaceHolder implements Serializable {
36:
37: private Set intfs = new HashSet();
38:
39: @Basic
40: @Column(length=35)
41: private String stringField;
42:
43: @OneToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST,CascadeType.REMOVE})
44: private InterfaceTest intf;
45:
46: @Id
47: private int id;
48:
49: public InterfaceHolder() {
50: }
51:
52: public InterfaceHolder(int id) {
53: this .id = id;
54: }
55:
56: public void setIntf(InterfaceTest intf) {
57: this .intf = intf;
58: }
59:
60: public InterfaceTest getIntf() {
61: return this .intf;
62: }
63:
64: public void setIntfs(Set intfs) {
65: this .intfs = intfs;
66: }
67:
68: public Set getIntfs() {
69: return this .intfs;
70: }
71:
72: public void setId(int id) {
73: this .id = id;
74: }
75:
76: public int getId() {
77: return this .id;
78: }
79:
80: public String toString() {
81: return "intfs: " + intfs + ", StringField: " + stringField
82: + ", Intf: " + intf + ".";
83: }
84: }
|