KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tutorial > entity > bean > LineItem


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.entity.bean;
8
9 import javax.persistence.Entity;
10 import javax.persistence.GeneratorType;
11 import javax.persistence.Id;
12 import javax.persistence.JoinColumn;
13 import javax.persistence.ManyToOne;
14 import javax.persistence.Entity;
15
16 @Entity
17 public class LineItem implements java.io.Serializable JavaDoc
18 {
19    private int id;
20    private double subtotal;
21    private int quantity;
22    private String JavaDoc product;
23    private Order order;
24
25
26    @Id(generate = GeneratorType.AUTO)
27    public int getId()
28    {
29       return id;
30    }
31
32    public void setId(int id)
33    {
34       this.id = id;
35    }
36
37    public double getSubtotal()
38    {
39       return subtotal;
40    }
41
42    public void setSubtotal(double subtotal)
43    {
44       this.subtotal = subtotal;
45    }
46
47    public int getQuantity()
48    {
49       return quantity;
50    }
51
52    public void setQuantity(int quantity)
53    {
54       this.quantity = quantity;
55    }
56
57    public String JavaDoc getProduct()
58    {
59       return product;
60    }
61
62    public void setProduct(String JavaDoc product)
63    {
64       this.product = product;
65    }
66
67    @ManyToOne
68    @JoinColumn(name = "order_id")
69    public Order getOrder()
70    {
71       return order;
72    }
73
74    public void setOrder(Order order)
75    {
76       this.order = order;
77    }
78 }
79
Popular Tags