Saturday 16 March 2013

Generate the Access Bean for the EJB

The following diagram displays the interaction between commands, access beans, entity beans, and the database.











Below are the steps to create AccessBean for EJB:

Right click on WebSphereCommerceServerExtensionsData -> New -> Other -> EJB -> AccessBean

























 After click on Prepare for Deployment - below are the list of java classes gets generated:


Generate the EJB to RDB Mapping

Below are the steps we need to follow to map between EJB and Database





















































 Drag and drop XBonusEJB from left panel to right panel XBONUS

















Then drag and drop all the attributes from left panel to right panel- This creates the relation between EJB and Database.























change DB2ADMIN TO NULLID -> this is require to make ejb as schema independent
























Edit the methods of the bean class XBonusEJBBean to call optimistic locking classes:



     /**
     * ejbLoad
     */
    public void ejbLoad() {
        super.ejbLoad();
        _initLinks();
    }

    /**
     * ejbStore
     */
    public void ejbStore() {
        super.ejbStore();
    }