|
||||||||
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 "bean 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()
Mandatory methods |
BuyNowPK |
ejbCreate(java.lang.Integer BuyNowUserId,
java.lang.Integer BuyNowItemId,
int quantity)
This method is used to create a new BuyNow Bean. |
java.util.Collection |
ejbFindAllBuyNows()
This method is used to retrieve all BuyNows from the database! |
java.util.Collection |
ejbFindByItem(java.lang.Integer id)
This method is used to retrieve all BuyNow Beans related to one item. |
BuyNowPK |
ejbFindByPrimaryKey(BuyNowPK id)
This method is used to retrieve a BuyNow Bean from its primary key, that is to say its id. |
java.util.Collection |
ejbFindByUser(java.lang.Integer id)
This method is used to retrieve all BuyNow Beans belonging to a specific user. |
java.util.Collection |
ejbFindUserBuyNow(java.lang.Integer userId)
Get all the items the user bought using the buy-now option in the last 30 days. |
void |
ejbLoad()
Read the reccord from the database and update the bean. |
void |
ejbPassivate()
|
void |
ejbPostCreate(java.lang.Integer BuyNowUserId,
java.lang.Integer BuyNowItemId,
int quantity)
This method does currently nothing |
void |
ejbRemove()
This method delete the record from the database. |
void |
ejbStore()
Update the record. |
java.lang.Integer |
getBuyerId()
Get the buyer id which is the primary key in the users table. |
java.sql.Connection |
getConnection()
Retrieve a connection.. |
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. |
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() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.Integer getBuyerId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.Integer getItemId() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic int getQuantity() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic java.lang.String getDate() throws java.rmi.RemoteException
java.rmi.RemoteException
- if an error occurspublic void setBuyerId(java.lang.Integer id) throws java.rmi.RemoteException
id
- buyer idjava.rmi.RemoteException
- if an error occurspublic void setItemId(java.lang.Integer id) throws java.rmi.RemoteException
id
- item idjava.rmi.RemoteException
- if an error occurspublic void setQuantity(int Qty) throws java.rmi.RemoteException
Qty
- quantityjava.rmi.RemoteException
- if an error occurspublic void setDate(java.lang.String newDate) throws java.rmi.RemoteException
newDate
- BuyNow datejava.rmi.RemoteException
- if an error occurspublic java.sql.Connection getConnection() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic BuyNowPK ejbFindByPrimaryKey(BuyNowPK id) throws javax.ejb.FinderException, java.rmi.RemoteException
id
- BuyNow id (primary key)javax.ejb.FinderException
- if an error occursjava.rmi.RemoteException
- if an error occurspublic java.util.Collection ejbFindByItem(java.lang.Integer id) throws javax.ejb.FinderException, java.rmi.RemoteException
id
- item idjavax.ejb.FinderException
- if an error occursjava.rmi.RemoteException
- if an error occurspublic java.util.Collection ejbFindByUser(java.lang.Integer id) throws javax.ejb.FinderException, java.rmi.RemoteException
id
- user idjavax.ejb.FinderException
- if an error occursjava.rmi.RemoteException
- if an error occurspublic java.util.Collection ejbFindAllBuyNows() throws java.rmi.RemoteException, javax.ejb.FinderException
java.rmi.RemoteException
- if an error occursjavax.ejb.FinderException
- if an error occurspublic java.util.Collection ejbFindUserBuyNow(java.lang.Integer userId) throws java.rmi.RemoteException, javax.ejb.FinderException
userId
- user idjava.rmi.RemoteException
- if an error occursjavax.ejb.FinderException
- if an error occurspublic BuyNowPK ejbCreate(java.lang.Integer BuyNowUserId, java.lang.Integer BuyNowItemId, int quantity) throws javax.ejb.CreateException, java.rmi.RemoteException, javax.ejb.RemoveException
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 occursjava.rmi.RemoteException
- if an error occursjavax.ejb.RemoveException
- if an error occurspublic void ejbPostCreate(java.lang.Integer BuyNowUserId, java.lang.Integer BuyNowItemId, int quantity)
public void ejbActivate() throws java.rmi.RemoteException
ejbActivate
in interface javax.ejb.EntityBean
public void ejbPassivate() throws java.rmi.RemoteException
ejbPassivate
in interface javax.ejb.EntityBean
public void ejbRemove() throws java.rmi.RemoteException, javax.ejb.RemoveException
ejbRemove
in interface javax.ejb.EntityBean
java.rmi.RemoteException
- if an error occursjavax.ejb.RemoveException
- if an error occurspublic void ejbStore() throws java.rmi.RemoteException
ejbStore
in interface javax.ejb.EntityBean
java.rmi.RemoteException
- if an error occurspublic void ejbLoad() throws java.rmi.RemoteException
ejbLoad
in interface javax.ejb.EntityBean
java.rmi.RemoteException
- if an error occurspublic void setEntityContext(javax.ejb.EntityContext context) throws java.rmi.RemoteException
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.java.rmi.RemoteException
- - This exception is defined in the method signature
to provide backward compatibility for enterprise beans
written for the EJB 1.0 specification.
Enterprise beans written for the EJB 1.1 and
higher specification should throw the javax.ejb.EJBException
instead of this exception.public void unsetEntityContext() throws java.rmi.RemoteException
unsetEntityContext
in interface javax.ejb.EntityBean
javax.ejb.EJBException
- Thrown by the method to indicate a failure
caused by a system-level error.java.rmi.RemoteException
- - This exception is defined in the method signature
to provide backward compatibility for enterprise beans
written for the EJB 1.0 specification.
Enterprise beans written for the EJB 1.1 and
higher specification should throw the javax.ejb.EJBException
instead of this exception.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |