| /******************************************************************************* |
| * Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved. |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 |
| * which accompanies this distribution. |
| * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html |
| * and the Eclipse Distribution License is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * Contributors: |
| * gonural - initial |
| ******************************************************************************/ |
| package org.eclipse.persistence.jpars.test.model.traveler; |
| |
| import static javax.persistence.CascadeType.ALL; |
| import static javax.persistence.FetchType.LAZY; |
| |
| import javax.persistence.Column; |
| import javax.persistence.Entity; |
| import javax.persistence.GeneratedValue; |
| import javax.persistence.Id; |
| import javax.persistence.JoinColumn; |
| import javax.persistence.OneToOne; |
| import javax.persistence.Table; |
| import javax.persistence.Version; |
| import javax.xml.bind.annotation.XmlElement; |
| import javax.xml.bind.annotation.XmlRootElement; |
| |
| @Entity |
| @Table(name = "JPARS_TRAVELER") |
| @XmlRootElement(namespace = "http://example.org") |
| public class Traveler { |
| |
| @Id |
| @Column(name = "TRV_ID") |
| @GeneratedValue |
| private int id; |
| |
| @Column(name = "F_NAME") |
| @XmlElement(namespace = "http://example.org/fname") |
| private String firstName; |
| |
| @Column(name = "L_NAME") |
| private String lastName; |
| |
| @Version |
| private Long version; |
| |
| @OneToOne(cascade = ALL, fetch = LAZY, orphanRemoval = true) |
| @JoinColumn(name = "RSRV_ID") |
| private Reservation reservation; |
| |
| public Traveler() { |
| } |
| |
| public Traveler(int id, String firstName, String lastName) { |
| setId(id); |
| setFirstName(firstName); |
| setLastName(lastName); |
| } |
| |
| public int getId() { |
| return id; |
| } |
| |
| public void setId(int empId) { |
| this.id = empId; |
| } |
| |
| public String getFirstName() { |
| return firstName; |
| } |
| |
| public void setFirstName(String fName) { |
| this.firstName = fName; |
| } |
| |
| public String getLastName() { |
| return lastName; |
| } |
| |
| public void setLastName(String lName) { |
| this.lastName = lName; |
| } |
| |
| public Long getVersion() { |
| return version; |
| } |
| |
| public void setVersion(Long version) { |
| this.version = version; |
| } |
| |
| public Reservation getReservation() { |
| return reservation; |
| } |
| |
| public void setReservation(Reservation reservation) { |
| this.reservation = reservation; |
| } |
| |
| public String toString() { |
| return "Employee(" + getId() + ": " + getLastName() + ", " + getFirstName() + ")"; |
| } |
| } |