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

import javax.persistence.AccessType;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
import javax.persistence.Version;
import javax.persistence.CascadeType;

import java.util.Set;

/**
 * Flight
 *
 * @author Emmanuel Bernard
 */
@Entity(access = AccessType.FIELD)
public class FieldFlight implements java.io.Serializable
{
   @Id
   Long id;

   @Column(updatable = false, name = "flight_name", nullable = false, length = 50)
   String name;

   @Basic(fetch = FetchType.LAZY)
   long duration;

   @Transient
   long durationInSec;

   @Version
   @Column(name = "OPTLOCK")
   Integer version;

   @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
   @JoinColumn(name = "COMP_ID")
   FieldCompany company;

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

   public Long getId()
   {
      return id;
   }

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

   public String getName()
   {
      return name;
   }

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

   public long getDuration()
   {
      return duration;
   }

   public void setDuration(long l)
   {
      duration = l;
   }

   public long getDurationInSec()
   {
      return durationInSec;
   }

   public void setDurationInSec(long l)
   {
      durationInSec = l;
   }

   public Integer getVersion()
   {
      return version;
   }

   public void setVersion(Integer i)
   {
      version = i;
   }

   public FieldCompany getCompany()
   {
      return company;
   }

   public void setCompany(FieldCompany company)
   {
      this.company = company;
   }

   public Set<FieldCustomer> getCustomers()
   {
      return customers;
   }

   public void setCustomers(Set<FieldCustomer> customers)
   {
      this.customers = customers;
   }
}
