Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stateful Session Bean

Status
Not open for further replies.

DB2Problem

Programmer
Oct 17, 2002
53
US
Hello ALL,

I thought of asking 2 more questions.

The questions are related to the architectural issues

1. I am calling a Service excute() method, which in turn calls another method viewCart().

In my viewCart() method, I am using following lines of code. This is my client to EJB.

public void viewCart(Request request) throws Exception {
CartRemoteInterface cart = null;
Context ctx1 = null;
DataSource DSource = null;
CartHomeInterface cartHomeInterface = null;
final String LOOKUP_SOURCE = "com/dcx/slsmkt/empadv/ejb/session/ShoppingCart";
session = request.getSession(true);

cart = (CartRemoteInterface) session.getAttribute("CartRemoteInterface");
if (cart != null) {
// doing nothing, I don't know what I can do here ?? You can help (any suggestion)
} else {
// call Statefull session bean
Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
ctx1 = new InitialContext(parms);
cartRemoteInterface = cartHomeInterface.create(customerID);
session.setAttribute("CartRemoteInterface", cartRemoteInterface);
}
}

Question on above code -

Do i need to put cartRemoteInterface.remove() after setAttribute. If Yes, Why ??

2. What is the importance of using UserTranscation when designing Shopping Cart application(A statefull session bean).

Do i need to have it, if YES, what would be default declarative transcation.

Your information or any feedback will really help me in designing this ..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top