KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > query > Dictionary


1 //$Id: Dictionary.java,v 1.1 2005/06/18 14:27:33 epbernard Exp $
2
package org.hibernate.test.annotations.query;
3
4 import javax.persistence.DiscriminatorColumn;
5 import javax.persistence.Entity;
6 import javax.persistence.EntityResult;
7 import javax.persistence.FieldResult;
8 import javax.persistence.Inheritance;
9 import javax.persistence.NamedNativeQuery;
10 import javax.persistence.SqlResultSetMapping;
11 import javax.persistence.Id;
12 import javax.persistence.GeneratorType;
13
14 /**
15  * @author Emmanuel Bernard
16  */

17 @Entity
18 @DiscriminatorColumn(name = "disc")
19 @Inheritance(discriminatorValue = "Dic")
20 @SqlResultSetMapping(
21         name="dictionary", entities = {
22         @EntityResult(
23             name="org.hibernate.test.annotations.query.Dictionary",
24             fields = {
25                 @FieldResult(name="id", column="id"),
26                 @FieldResult(name="name", column="name"),
27                 @FieldResult(name="editor", column="editor")
28             },
29             discriminatorColumn = "type"
30         )
31     }
32 )
33 @NamedNativeQuery(name="all.dictionaries",
34         queryString="select id, name, editor, disc as type from Dictionary",
35         resultSetMapping="dictionary")
36 public class Dictionary {
37     private Integer JavaDoc id;
38     private String JavaDoc name;
39     private String JavaDoc editor;
40
41     @Id(generate=GeneratorType.AUTO)
42     public Integer JavaDoc getId() {
43         return id;
44     }
45
46     public void setId(Integer JavaDoc id) {
47         this.id = id;
48     }
49
50     public String JavaDoc getName() {
51         return name;
52     }
53
54     public void setName(String JavaDoc name) {
55         this.name = name;
56     }
57
58     public String JavaDoc getEditor() {
59         return editor;
60     }
61
62     public void setEditor(String JavaDoc editor) {
63         this.editor = editor;
64     }
65 }
66
Popular Tags