Jboss Ejb3.0 Entity Bean

Source: Internet
Author: User
Tags jboss

Order. java
Package org. jboss. tutorial. entity. bean;
Import javax. persistence. CascadeType;
Import javax. persistence. Entity;
Import javax. persistence. FetchType;
Import javax. persistence. GeneratorType;
Import javax. persistence. Id;
Import javax. persistence. Onetoence;
Import javax. persistence. Table;
Import javax. persistence. Id;
Import javax. persistence. CascadeType;
Import javax. persistence. FetchType;
Import java. util. ArrayList;
Import java. util. Collection;
@ Entity
@ Table (name = "PURCHASE_ORDER ")
// If the table name isn' t specified it defaults to the bean name
// Of the class. For instance, the LineItem EJB wocould be mapped
// The LINEITEM table
Public class Order implements java. io. Serializable
{
Private int id;
Private double total;
Private Collection <LineItem> lineItems;
@ Id (generate = GeneratorType. AUTO)
Public int getId ()
   {
Return id;
   }
Public void setId (int id)
   {
This. id = id;
   }
Public double getTotal ()
   {
Return total;
   }
Public void setTotal (double total)
   {
This. total = total;
   }
Public void addPurchase (String product, int quantity, double price)
   {
If (lineItems = null) lineItems = new ArrayList <LineItem> ();
LineItem item = new LineItem ();
Item. setOrder (this );
Item. setProduct (product );
Item. setQuantity (quantity );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.