KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tutorial > tableperinheritance > 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.tableperinheritance.bean;
8
9 import javax.persistence.Entity;
10 import javax.persistence.GeneratorType;
11 import javax.persistence.Id;
12 import javax.persistence.Inheritance;
13 import javax.persistence.InheritanceType;
14 import javax.persistence.Id;
15 import javax.persistence.Inheritance;
16 import javax.persistence.InheritanceType;
17 import javax.persistence.Entity;
18
19 @Entity
20 @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
21 public class Pet implements java.io.Serializable JavaDoc
22 {
23    private int id;
24    private String JavaDoc name;
25    private double weight;
26
27    @Id(generate = GeneratorType.TABLE)
28    public int getId()
29    {
30       return id;
31    }
32
33    public void setId(int id)
34    {
35       this.id = id;
36    }
37
38    public String JavaDoc getName()
39    {
40       return name;
41    }
42
43    public void setName(String JavaDoc name)
44    {
45       this.name = name;
46    }
47
48    public double getWeight()
49    {
50       return weight;
51    }
52
53    public void setWeight(double weight)
54    {
55       this.weight = weight;
56    }
57 }
58
Popular Tags