1 package org.hibernate.test.annotations.inheritance.union; 3 4 import javax.persistence.Entity; 5 import javax.persistence.Id; 6 import javax.persistence.Inheritance; 7 import javax.persistence.InheritanceType; 8 import javax.persistence.ManyToOne; 9 10 13 @Entity 14 @Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) 15 public abstract class File { 16 private String name; 17 private Folder parent; 18 19 File() {} 20 public File(String name) { 21 this.name = name; 22 } 23 24 @Id 25 public String getName() { 26 return name; 27 } 28 29 public void setName(String id) { 30 this.name = id; 31 } 32 33 @ManyToOne 34 public Folder getParent() { 35 return parent; 36 } 37 public void setParent(Folder parent) { 38 this.parent = parent; 39 } 40 41 } 42 | Popular Tags |