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.common.apps;
20:
21: import javax.persistence.*;
22: import org.apache.openjpa.persistence.*;
23:
24: import java.util.*;
25:
26: @Entity
27: @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
28: public class CompUser {
29: @Basic
30: @Column(length=50)
31: private String name;
32:
33: @Basic
34: private int age;
35:
36: @Basic
37: @Column(name="compName",length=50)
38: private String computerName;
39:
40: @PersistentCollection
41: private String[] nicknames = new String[0];
42:
43: @OneToOne(cascade={CascadeType.PERSIST,CascadeType.REMOVE})
44: @JoinColumn(name="ADD_ID")
45: private Address address;
46:
47: @Id
48: @GeneratedValue(strategy=GenerationType.AUTO)
49: public int userid;
50:
51: public CompUser() {
52: }
53:
54: public CompUser(String name, String cName, Address address, int age) {
55: this .name = name;
56: this .computerName = cName;
57: this .address = address;
58: this .age = age;
59: }
60:
61: public String getComputerName() {
62: return computerName;
63: }
64:
65: public void setComputerName(String computerName) {
66: this .computerName = computerName;
67: }
68:
69: public String getName() {
70: return name;
71: }
72:
73: public void setName(String name) {
74: this .name = name;
75: }
76:
77: public int getUserid() {
78: return userid;
79: }
80:
81: public Address getAddress() {
82: return address;
83: }
84:
85: public void setAddress(Address address) {
86: this .address = address;
87: }
88:
89: public int getAge() {
90: return age;
91: }
92:
93: public void setAge(int age) {
94: this.age = age;
95: }
96:
97: }
|