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.models.company.idclass;
20:
21: import java.util.*;
22: import javax.persistence.*;
23: import org.apache.openjpa.persistence.models.company.*;
24:
25: @Entity(name="IDC_Company")
26: public class Company implements ICompany {
27: private static int ids = 1;
28:
29: @Id
30: private int id = ++ids;
31:
32: @Basic
33: private String name;
34:
35: @OneToOne
36: private Address address;
37:
38: @OneToMany(mappedBy="company")
39: private Set<Employee> employees = new HashSet<Employee>();
40:
41: @ManyToMany(mappedBy="distributors")
42: private Set<Product> products = new HashSet<Product>();
43:
44: public void setName(String name) {
45: this .name = name;
46: }
47:
48: public String getName() {
49: return this .name;
50: }
51:
52: public void setAddress(IAddress address) {
53: this .address = (Address) address;
54: }
55:
56: public IAddress getAddress() {
57: return this .address;
58: }
59:
60: public void setEmployees(Set<? extends IEmployee> employees) {
61: this .employees = (Set<Employee>) employees;
62: }
63:
64: public Set<Employee> getEmployees() {
65: return this .employees;
66: }
67:
68: public void setProducts(Set<? extends IProduct> products) {
69: this .products = (Set<Product>) products;
70: }
71:
72: public Set<Product> getProducts() {
73: return this.products;
74: }
75: }
|