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.singletableinheritance;
023:
024: import javax.persistence.DiscriminatorColumn;
025: import javax.persistence.DiscriminatorType;
026: import javax.persistence.Entity;
027: import javax.persistence.GeneratedValue;
028: import javax.persistence.GenerationType;
029: import javax.persistence.Id;
030: import javax.persistence.Inheritance;
031: import javax.persistence.InheritanceType;
032: import javax.persistence.Version;
033:
034: /**
035: * @author Gavin King
036: */
037: @Entity
038: @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
039: @DiscriminatorColumn(name="person_type",discriminatorType=DiscriminatorType.STRING)
040: public class Person {
041: private long id;
042: private String name;
043: private String address;
044: private String zip;
045: private String country;
046: private char sex;
047: private int version;
048:
049: @Id
050: @GeneratedValue(strategy=GenerationType.AUTO)
051: public long getId() {
052: return id;
053: }
054:
055: public void setId(long id) {
056: this .id = id;
057: }
058:
059: public char getSex() {
060: return sex;
061: }
062:
063: public void setSex(char sex) {
064: this .sex = sex;
065: }
066:
067: public String getName() {
068: return name;
069: }
070:
071: public void setName(String identity) {
072: this .name = identity;
073: }
074:
075: public String getCountry() {
076: return country;
077: }
078:
079: public void setCountry(String country) {
080: this .country = country;
081: }
082:
083: public String getZip() {
084: return zip;
085: }
086:
087: public void setZip(String zip) {
088: this .zip = zip;
089: }
090:
091: public String getAddress() {
092: return address;
093: }
094:
095: public void setAddress(String address) {
096: this .address = address;
097: }
098:
099: @Version
100: public int getVersion() {
101: return version;
102: }
103:
104: public void setVersion(int version) {
105: this.version = version;
106: }
107: }
|