001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: Customer.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.entity.customer;
025:
026: import java.io.Serializable;
027: import java.util.List;
028:
029: import javax.persistence.CascadeType;
030: import javax.persistence.Entity;
031: import javax.persistence.Id;
032: import javax.persistence.OneToMany;
033: import javax.persistence.OneToOne;
034:
035: /**
036: * The customer.
037: * @author Gisele Pinheiro Souza
038: * @author Eduardo Studzinski Estima de Castro
039: *
040: */
041: @Entity
042: public class Customer implements Serializable {
043:
044: /**
045: * The serial version.
046: */
047: private static final long serialVersionUID = -5935600735100590395L;
048:
049: /**
050: * The customer id.
051: */
052: private long id;
053:
054: /**
055: * The customer name.
056: */
057: private String name;
058:
059: /**
060: * The orders.
061: */
062: private List<ProductOrder> orders;
063:
064: /**
065: * The address.
066: */
067: private Address address;
068:
069: /**
070: * Gets the customer address.
071: * @return the address.
072: */
073: @OneToOne(cascade=CascadeType.PERSIST)
074: public Address getAddress() {
075: return address;
076: }
077:
078: /**
079: * Sets the customer address.
080: * @param address the new address.
081: */
082: public void setAddress(final Address address) {
083: this .address = address;
084: }
085:
086: /**
087: * Gets the customer identifier.
088: * @return the identifier.
089: */
090: @Id
091: public long getId() {
092: return id;
093: }
094:
095: /**
096: * Sets the customer identifier.
097: * @param id the customer identifier.
098: */
099: public void setId(final long id) {
100: this .id = id;
101: }
102:
103: /**
104: * Gets the customer name.
105: * @return the name.
106: */
107: public String getName() {
108: return name;
109: }
110:
111: /**
112: * Sets the customer name.
113: * @param name the new name.
114: */
115: public void setName(final String name) {
116: this .name = name;
117: }
118:
119: /**
120: * Gets the client orders.
121: * @return the orders.
122: */
123: @OneToMany(cascade=CascadeType.MERGE)
124: public List<ProductOrder> getOrders() {
125: return orders;
126: }
127:
128: /**
129: * Sets the orders.
130: * @param orders the list of orders.
131: */
132: public void setOrders(final List<ProductOrder> orders) {
133: this.orders = orders;
134: }
135:
136: }
|