1 7 package org.jboss.tutorial.singleinheritance.bean; 8 9 import javax.persistence.DiscriminatorColumn; 10 import javax.persistence.DiscriminatorType; 11 import javax.persistence.Entity; 12 import javax.persistence.GeneratorType; 13 import javax.persistence.Id; 14 import javax.persistence.Inheritance; 15 import javax.persistence.Inheritance; 16 import javax.persistence.InheritanceType; 17 import javax.persistence.Entity; 18 19 @Entity 20 @Inheritance(strategy = InheritanceType.SINGLE_TABLE, discriminatorType = DiscriminatorType.STRING) 21 @DiscriminatorColumn(name = "ANIMAL_TYPE", nullable = true) 22 public class Pet implements java.io.Serializable 23 { 24 private int id; 25 private String name; 26 private double weight; 27 28 @Id(generate = GeneratorType.AUTO) 29 public int getId() 30 { 31 return id; 32 } 33 34 public void setId(int id) 35 { 36 this.id = id; 37 } 38 39 public String getName() 40 { 41 return name; 42 } 43 44 public void setName(String name) 45 { 46 this.name = name; 47 } 48 49 public double getWeight() 50 { 51 return weight; 52 } 53 54 public void setWeight(double weight) 55 { 56 this.weight = weight; 57 } 58 } 59 | Popular Tags |