001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.ejb3.test.entity;
023:
024: import java.util.Set;
025: import javax.persistence.Basic;
026: import javax.persistence.CascadeType;
027: import javax.persistence.Column;
028: import javax.persistence.Entity;
029: import javax.persistence.FetchType;
030: import javax.persistence.Id;
031: import javax.persistence.JoinColumn;
032: import javax.persistence.ManyToMany;
033: import javax.persistence.ManyToOne;
034: import javax.persistence.Transient;
035: import javax.persistence.Version;
036:
037: /**
038: * Flight
039: *
040: * @author Emmanuel Bernard
041: */
042: @Entity
043: public class FieldFlight implements java.io.Serializable {
044: @Id
045: Long id;
046:
047: @Column(updatable=false,name="flight_name",nullable=false,length=50)
048: String name;
049:
050: @Basic(fetch=FetchType.LAZY)
051: long duration;
052:
053: @Transient
054: long durationInSec;
055:
056: @Version
057: @Column(name="OPTLOCK")
058: Integer version;
059:
060: @ManyToOne(cascade={CascadeType.PERSIST,CascadeType.MERGE})
061: @JoinColumn(name="COMP_ID")
062: FieldCompany company;
063:
064: @ManyToMany(cascade={CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.EAGER)
065: Set<FieldCustomer> customers;
066:
067: public Long getId() {
068: return id;
069: }
070:
071: public void setId(Long long1) {
072: id = long1;
073: }
074:
075: public String getName() {
076: return name;
077: }
078:
079: public void setName(String string) {
080: name = string;
081: }
082:
083: public long getDuration() {
084: return duration;
085: }
086:
087: public void setDuration(long l) {
088: duration = l;
089: }
090:
091: public long getDurationInSec() {
092: return durationInSec;
093: }
094:
095: public void setDurationInSec(long l) {
096: durationInSec = l;
097: }
098:
099: public Integer getVersion() {
100: return version;
101: }
102:
103: public void setVersion(Integer i) {
104: version = i;
105: }
106:
107: public FieldCompany getCompany() {
108: return company;
109: }
110:
111: public void setCompany(FieldCompany company) {
112: this .company = company;
113: }
114:
115: public Set<FieldCustomer> getCustomers() {
116: return customers;
117: }
118:
119: public void setCustomers(Set<FieldCustomer> customers) {
120: this.customers = customers;
121: }
122: }
|