Load and Store Methods in Servicing Instance Strategy.

Enterprise Java
Connection Strategies in EntityBeans

Prakash Malani
Listing 6. Load and Store Methods in Servicing Instance Strategy.


protected void doLoad () {
    try {
        ProductDAO aPD = new ProductDAO (mConnection);
        aPD.setUPC(mUPC);
        aPD.load();
        mDescription = aPD.getDescription();
    } catch (SQLException e) {
        e.printStackTrace();
        throw new EJBException ("In ProductEJB: doLoad:\t" +  
            e.getMessage());
    }
}

protected void doStore () {
    try {
        ProductDAO aPD = new ProductDAO (mConnection);
        aPD.setUPC(mUPC);
        aPD.setDescription(mDescription);
        aPD.store();
    } catch (SQLException e) {
        e.printStackTrace();
        throw new EJBException ("In ProductEJB: doStore:\t" +
            e.getMessage());
    }
}

About the Author

Prakash Malani is principal engineer at eBuilt Inc., Irvine, CA. Mr. Malani can be contacted at [email protected].