/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
//$Id: FieldCustomer.java,v 1.4.2.5 2005/09/27 01:49:19 starksm Exp $
package org.jboss.ejb3.test.entity;

import javax.persistence.AccessType;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratorType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OneToMany;
import javax.persistence.Entity;

import java.util.Set;

/**
 * Company customer
 *
 * @author Emmanuel Bernard
 */
@Entity(access = AccessType.FIELD)
public class FieldCustomer implements java.io.Serializable
{
   @Id(generate = GeneratorType.IDENTITY)
   Long id;

   String name;

   @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="customer")
   Set<FieldTicket> tickets;

   @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, fetch = FetchType.EAGER, mappedBy="customers")
   Set<FieldFlight> flights;

   @OneToOne(cascade = {CascadeType.ALL})
   @JoinColumn(name = "ADDRESS_ID")
   FieldAddress address;

   public FieldCustomer()
   {
   }

   public Long getId()
   {
      return id;
   }

   public String getName()
   {
      return name;
   }

   public void setId(Long long1)
   {
      id = long1;
   }

   public void setName(String string)
   {
      name = string;
   }

   public Set<FieldTicket> getTickets()
   {
      return tickets;
   }

   public void setTickets(Set<FieldTicket> tickets)
   {
      this.tickets = tickets;
   }

   public FieldAddress getAddress()
   {
      return address;
   }

   public void setAddress(FieldAddress address)
   {
      this.address = address;
   }

   public Set<FieldFlight> getFlights()
   {
      return flights;
   }

   public void setFlights(Set<FieldFlight> flights)
   {
      this.flights = flights;
   }

}

