Quick-and-Release Strategy.

Enterprise Java
Connection Strategies in EntityBeans

Prakash Malani
Listing 3. Quick-and-Release Strategy.


public void ejbLoad () {
     doLoad ();
 }

protected void doLoad () {
     ConnectionTemplate aCT = new ConnectionTemplate () {
         public Object doMethod (Connection c) throws SQLException {
             ProductDAO aPD = new ProductDAO (c);
             aPD.setUPC(mUPC);
             aPD.load();
             mDescription = aPD.getDescription();
             return null;
         };
     };
     aCT.invokeMethod(DATA_SOURCE_NAME);
 }

About the Author

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