SupplierBean.java
资源名称:MyStore.rar [点击查看]
上传用户:hgs128
上传日期:2007-02-03
资源大小:166k
文件大小:8k
源码类别:
百货/超市行业
开发平台:
WINDOWS
- /*
- * Created on 1999-5-18
- */
- package cmp;
- import java.rmi.RemoteException;
- import javax.ejb.EJBException;
- import javax.ejb.EntityBean;
- import javax.ejb.EntityContext;
- /**
- * @ejb.bean name="Supplier"
- * jndi-name="SupplierBean"
- * type="CMP"
- * primkey-field="supplierid"
- * schema="mySupplier"
- * cmp-version="2.x"
- *
- *--
- * This is needed for JOnAS.
- * If you are not using JOnAS you can safely remove the tags below.
- * @jonas.bean ejb-name="Supplier"
- * jndi-name="SupplierBean"
- * @jonas.jdbc-mapping jndi-name="java:/OracleDS" jdbc-table-name="supplier"
- * --
- *
- * @ejb.persistence
- * table-name="supplier"
- *
- * @ejb.finder
- * query="SELECT OBJECT(a) FROM mySupplier as a"
- * signature="java.util.Collection findAll()"
- *
- * @ejb.finder
- * query="SELECT OBJECT(b) from mySupplier as b where b.userid=?1"
- * signature="SupplierLocal findUserID(java.lang.String userID)"
- *--
- * This is needed for JOnAS.
- * If you are not using JOnAS you can safely remove the tags below.
- * @jonas.finder-method-jdbc-mapping method-name="findAll"
- * jdbc-where-clause=""
- * @jonas.jdbc-mapping jndi-name="java:/OracleDS"
- * jdbc-table-name="supplier"
- *
- *--
- *
- **/
- public abstract class SupplierBean implements EntityBean {
- protected EntityContext eContext ;
- /**
- * The ejbCreate method.
- *
- * @ejb.create-method
- */
- public java.lang.String ejbCreate(String supplierID, String userID,
- String firstname, String lastname, String address, String message,
- Float credit_limit) throws javax.ejb.CreateException {
- // EJB 2.0 spec says return null for CMP ejbCreate methods.
- // TODO: YOU MUST INITIALIZE THE FIELDS FOR THE BEAN HERE.
- // setMyField("Something");
- System.out.println("Entering SupplierBean,ejbCreate()");
- setSupplierid(supplierID);
- setUserid(userID);
- setFirstname(firstname);
- setLastname(lastname);
- setAddress(address);
- setMessage(message);
- setCredit_limit(credit_limit);
- System.out.println("Leaving SupplierBean.ejbCreate()");
- return null;
- }
- /**
- * The container invokes this method immediately after it calls ejbCreate.
- *
- */
- public void ejbPostCreate() throws javax.ejb.CreateException {
- }
- /**
- * Returns the supplierid
- * @return the supplierid
- *
- * @ejb.persistent-field
- * @ejb.persistence
- * column-name="supplierid"
- * sql-type="varchar2"
- * @ejb.pk-field
- * @ejb.interface-method
- *
- * --
- * This is needed for JOnAS.
- * If you are not using JOnAS you can safely remove the tags below.
- * @jonas.cmp-field-jdbc-mapping field-name="supplierid"
- * jdbc-field-name="supplierid"
- *
- --
- */
- public abstract java.lang.String getSupplierid();
- /**
- * Sets the supplierid
- *
- * @param java.lang.String the new supplierid value
- *
- * @ejb.interface-method
- */
- public abstract void setSupplierid(java.lang.String supplierid);
- /**
- * Returns the userid
- * @return the userid
- *
- * @ejb.persistent-field
- * @ejb.persistence
- * column-name="userid"
- * sql-type="varchar2"
- *
- * @ejb.interface-method
- *
- * --
- * This is needed for JOnAS.
- * If you are not using JOnAS you can safely remove the tags below.
- * @jonas.cmp-field-jdbc-mapping field-name="userid"
- * jdbc-field-name="userid"
- *
- --
- */
- public abstract java.lang.String getUserid();
- /**
- * Sets the userid
- *
- * @param java.lang.String the new userid value
- *
- * @ejb.interface-method
- */
- public abstract void setUserid(java.lang.String userid);
- /**
- * Returns the firstname
- * @return the firstname
- *
- * @ejb.persistent-field
- * @ejb.persistence
- * column-name="firstname"
- * sql-type="varchar2"
- *
- * @ejb.interface-method
- *
- * --
- * This is needed for JOnAS.
- * If you are not using JOnAS you can safely remove the tags below.
- * @jonas.cmp-field-jdbc-mapping field-name="firstname"
- * jdbc-field-name="firstname"
- *
- --
- */
- public abstract java.lang.String getFirstname();
- /**
- * Sets the firstname
- *
- * @param java.lang.String the new firstname value
- *
- * @ejb.interface-method
- */
- public abstract void setFirstname(java.lang.String firstname);
- /**
- * Returns the lastname
- * @return the lastname
- *
- * @ejb.persistent-field
- * @ejb.persistence
- * column-name="lastname"
- * sql-type="varchar2"
- *
- * @ejb.interface-method
- *
- * --
- * This is needed for JOnAS.
- * If you are not using JOnAS you can safely remove the tags below.
- * @jonas.cmp-field-jdbc-mapping field-name="lastname"
- * jdbc-field-name="lastname"
- *
- --
- */
- public abstract java.lang.String getLastname();
- /**
- * Sets the lastname
- *
- * @param java.lang.String the new lastname value
- *
- * @ejb.interface-method
- */
- public abstract void setLastname(java.lang.String lastname);
- /**
- * Returns the address
- * @return the address
- *
- * @ejb.persistent-field
- * @ejb.persistence
- * column-name="address"
- * sql-type="varchar2"
- *
- * @ejb.interface-method
- *
- * --
- * This is needed for JOnAS.
- * If you are not using JOnAS you can safely remove the tags below.
- * @jonas.cmp-field-jdbc-mapping field-name="address"
- * jdbc-field-name="address"
- *
- --
- */
- public abstract java.lang.String getAddress();
- /**
- * Sets the address
- *
- * @param java.lang.String the new address value
- *
- * @ejb.interface-method
- */
- public abstract void setAddress(java.lang.String address);
- /**
- * Returns the message
- * @return the message
- *
- * @ejb.persistent-field
- * @ejb.persistence
- * column-name="message"
- * sql-type="varchar2"
- *
- * @ejb.interface-method
- *
- * --
- * This is needed for JOnAS.
- * If you are not using JOnAS you can safely remove the tags below.
- * @jonas.cmp-field-jdbc-mapping field-name="message"
- * jdbc-field-name="message"
- *
- --
- */
- public abstract java.lang.String getMessage();
- /**
- * Sets the message
- *
- * @param java.lang.String the new message value
- *
- * @ejb.interface-method
- */
- public abstract void setMessage(java.lang.String message);
- /**
- * Returns the credit_limit
- * @return the credit_limit
- *
- * @ejb.persistent-field
- * @ejb.persistence
- * column-name="credit_limit"
- * sql-type="decimal"
- *
- * @ejb.interface-method
- *
- * --
- * This is needed for JOnAS.
- * If you are not using JOnAS you can safely remove the tags below.
- * @jonas.cmp-field-jdbc-mapping field-name="credit_limit"
- * jdbc-field-name="credit_limit"
- *
- --
- */
- public abstract java.lang.Float getCredit_limit();
- /**
- * Sets the credit_limit
- *
- * @param java.lang.Float the new credit_limit value
- *
- * @ejb.interface-method
- */
- public abstract void setCredit_limit(java.lang.Float credit_limit);
- /**
- * @ejb.interface-method
- * view-type="local"
- **/
- public SupplierData getSupplierData() {
- System.out.println ("Entering SupplierBean.getSupplierData() ");
- System.out.println ("Leaving SupplierBean.getSupplierData() ");
- return new SupplierData(getSupplierid(),getUserid(),getFirstname(),getLastname(),
- getAddress(),getMessage(),getCredit_limit());
- }
- /**
- * @ejb.interface-method
- * view-type="local"
- **/
- public void requestItem (java.lang.String itemID, java.lang.Integer quantity) {
- System.out.println (" Entering SupplierBean.requestItem() " + quantity.toString() );
- String message = itemID + quantity.toString();
- this.setMessage(message);
- System.out.println (" Leaving SupplierBean.requestItem()");
- }
- /* (non-Javadoc)
- * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
- */
- public void setEntityContext(EntityContext context) throws EJBException,
- RemoteException {
- eContext = context;
- }
- /* (non-Javadoc)
- * @see javax.ejb.EntityBean#unsetEntityContext()
- */
- public void unsetEntityContext() throws EJBException, RemoteException {
- eContext = null;
- }
- }