DB2Problem
Programmer
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 ..
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 ..