1 22 package org.jboss.ejb3.test.joininheritance; 23 24 import javax.persistence.Entity; 25 import javax.persistence.Inheritance; 26 import javax.persistence.InheritanceType; 27 import javax.persistence.JoinColumn; 28 import javax.persistence.OneToOne; 29 import javax.persistence.Table; 30 import java.math.BigDecimal ; 31 32 35 @Entity 36 @Table(name="EMPLOYEE_TABLE") 37 @Inheritance(strategy = InheritanceType.JOINED) 38 public class Employee extends Person 39 { 40 private String title; 41 private BigDecimal salary; 42 private Employee manager; 43 44 47 public String getTitle() 48 { 49 return title; 50 } 51 52 55 public void setTitle(String title) 56 { 57 this.title = title; 58 } 59 60 @OneToOne 61 @JoinColumn(name = "manager") 62 public Employee getManager() 63 { 64 return manager; 65 } 66 67 70 public void setManager(Employee manager) 71 { 72 this.manager = manager; 73 } 74 75 78 public BigDecimal getSalary() 79 { 80 return salary; 81 } 82 83 86 public void setSalary(BigDecimal salary) 87 { 88 this.salary = salary; 89 } 90 } 91 | Popular Tags |