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.slice;
20:
21: import javax.persistence.*;
22:
23: @Entity
24: public class Person {
25: @Id
26: @GeneratedValue
27: private long id;
28:
29: private String name;
30:
31: @Version
32: private long version;
33:
34: @OneToOne(cascade=CascadeType.ALL)
35: private Address address;
36:
37: public Person() {
38: this ("?");
39: }
40:
41: public Person(String name) {
42: setName(name);
43: }
44:
45: public String getName() {
46: return name;
47: }
48:
49: public void setName(String name) {
50: this .name = name;
51: }
52:
53: public Address getAddress() {
54: return address;
55: }
56:
57: public void setAddress(Address address) {
58: this .address = address;
59: address.setOwner(this );
60: }
61:
62: public long getId() {
63: return id;
64: }
65:
66: public String toString() {
67: return name;
68: }
69:
70: public long getVersion() {
71: return version;
72: }
73: }
|