|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.rubis.beans.BuyNowBean
BuyNowBean is an entity bean with "container managed persistence". The state of an instance is stored into a relational database. The following table should exist:
CREATE TABLE buy_now ( id INTEGER UNSIGNED NOT NULL UNIQUE, buyer_id INTEGER UNSIGNED NOT NULL, item_id INTEGER UNSIGNED NOT NULL, qty INTEGER, date DATETIME, PRIMARY KEY(id), INDEX buyer (buyer_id), INDEX item (item_id) );
Field Summary | |
java.lang.Integer |
buyerId
|
java.lang.String |
date
|
java.lang.Integer |
id
|
java.lang.Integer |
itemId
|
int |
qty
|
Constructor Summary | |
BuyNowBean()
|
Method Summary | |
void |
ejbActivate()
This method is empty because persistence is managed by the container |
BuyNowPK |
ejbCreate(java.lang.Integer BuyNowUserId,
java.lang.Integer BuyNowItemId,
int quantity)
This method is used to create a new BuyNow Bean. |
void |
ejbLoad()
Persistence is managed by the container and the bean becomes up to date |
void |
ejbPassivate()
This method is empty because persistence is managed by the container |
void |
ejbPostCreate(java.lang.Integer BuyNowUserId,
java.lang.Integer BuyNowItemId,
int quantity)
This method just set an internal flag to reload the id generated by the DB |
void |
ejbRemove()
This method is empty because persistence is managed by the container |
void |
ejbStore()
Persistence is managed by the container and the bean becomes up to date |
java.lang.Integer |
getBuyerId()
Get the buyer id which is the primary key in the users table. |
java.lang.String |
getDate()
Time of the BuyNow in the format 'YYYY-MM-DD hh:mm:ss' |
java.lang.Integer |
getId()
Get BuyNow id. |
java.lang.Integer |
getItemId()
Get the item id which is the primary key in the items table. |
int |
getQuantity()
Get how many of this item the user has bought. |
boolean |
isModified()
Returns true if the beans has been modified. |
void |
setBuyerId(java.lang.Integer id)
Set a new buyer identifier. |
void |
setDate(java.lang.String newDate)
Set a new date for this BuyNow |
void |
setEntityContext(javax.ejb.EntityContext context)
Sets the associated entity context. |
void |
setItemId(java.lang.Integer id)
Set a new item identifier. |
void |
setQuantity(int Qty)
Set a new quantity for this BuyNow |
void |
unsetEntityContext()
Unsets the associated entity context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.lang.Integer id
public java.lang.Integer buyerId
public java.lang.Integer itemId
public int qty
public java.lang.String date
Constructor Detail |
public BuyNowBean()
Method Detail |
public java.lang.Integer getId()
public java.lang.Integer getBuyerId()
public java.lang.Integer getItemId()
public int getQuantity()
public java.lang.String getDate()
public void setBuyerId(java.lang.Integer id)
id
- buyer idpublic void setItemId(java.lang.Integer id)
id
- item idpublic void setQuantity(int Qty)
Qty
- quantitypublic void setDate(java.lang.String newDate)
newDate
- BuyNow datepublic BuyNowPK ejbCreate(java.lang.Integer BuyNowUserId, java.lang.Integer BuyNowItemId, int quantity) throws javax.ejb.CreateException
BuyNowUserId
- user id of the buyer, must match the primary key of table usersBuyNowItemId
- item id, must match the primary key of table itemsquantity
- number of items the user wants to buyjavax.ejb.CreateException
- if an error occurspublic void ejbPostCreate(java.lang.Integer BuyNowUserId, java.lang.Integer BuyNowItemId, int quantity)
public void ejbLoad()
ejbLoad
in interface javax.ejb.EntityBean
public void ejbStore()
ejbStore
in interface javax.ejb.EntityBean
public void ejbActivate()
ejbActivate
in interface javax.ejb.EntityBean
public void ejbPassivate()
ejbPassivate
in interface javax.ejb.EntityBean
public void ejbRemove()
ejbRemove
in interface javax.ejb.EntityBean
public void setEntityContext(javax.ejb.EntityContext context)
setEntityContext
in interface javax.ejb.EntityBean
context
- An EntityContext interface for the instance. The instance should
store the reference to the context in an instance variable.javax.ejb.EJBException
- Thrown by the method to indicate a failure
caused by a system-level error.public void unsetEntityContext()
unsetEntityContext
in interface javax.ejb.EntityBean
javax.ejb.EJBException
- Thrown by the method to indicate a failure
caused by a system-level error.public boolean isModified()
boolean
value
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |