KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tutorial > singleinheritance > bean > Pet


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

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 JavaDoc
23 {
24    private int id;
25    private String JavaDoc 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 JavaDoc getName()
40    {
41       return name;
42    }
43
44    public void setName(String JavaDoc 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