KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > inheritance > mixed > File


1 //$Id: File.java,v 1.3 2005/07/20 00:18:06 epbernard Exp $
2
package org.hibernate.test.annotations.inheritance.mixed;
3
4 import javax.persistence.DiscriminatorColumn;
5 import javax.persistence.Entity;
6 import javax.persistence.Id;
7 import javax.persistence.Inheritance;
8 import javax.persistence.InheritanceType;
9 import javax.persistence.JoinColumn;
10 import javax.persistence.ManyToOne;
11 import javax.persistence.SecondaryTable;
12 import javax.persistence.Table;
13
14 /**
15  * @author Emmanuel Bernard
16  */

17 @Entity
18 @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
19 @Table(name="FileMixed")
20 @SecondaryTable(name="FileFolderMixed")
21 @DiscriminatorColumn(length=1)
22 public abstract class File {
23     private String JavaDoc name;
24     private Folder parent;
25     
26     File() {}
27     public File(String JavaDoc name) {
28         this.name = name;
29     }
30
31     @Id
32     public String JavaDoc getName() {
33         return name;
34     }
35
36     public void setName(String JavaDoc id) {
37         this.name = id;
38     }
39     
40     @ManyToOne
41     @JoinColumn(secondaryTable="FileFolderMixed")
42     public Folder getParent() {
43         return parent;
44     }
45     public void setParent(Folder parent) {
46         this.parent = parent;
47     }
48
49 }
50
Popular Tags