I am trying to implement JTA transaction in my servlet.The
Servlet does a stateless session bean lookup which inturn calls the create method of an entity bean(BMP).The session bean transaction att is "supports" and the same for the BMP is "required".
The code snippet is as follows...
Context initialContext = new InitialContext();
UserTransaction userTran = (javax.transaction.UserTransaction)initialContext.lookup("java:comp/UserTransaction");
userTran.begin();
System.out.println("Begin Transaction");
Context ctx = new InitialContext();
AutoBidManagerHome bidhome = (AutoBidManagerHome)PortableRemoteObject.narrow(ctx.lookup("ejb/ejb/AutoBidManagerHome"),AutoBidManagerHome.class);
AutoBidManager BidObj = bidhome.create();
check=BidObj.processAutoBid();
userTran.commit();
System.out.println("End Transaction");
My problem is that the transactions are not getting executed one after another when the servlet is requeted concurrently by 2 different users as the server log shows "Begin Transaction","Begin Transaction","End Transaction","End Transaction" in this order,instead of Begin/End/Begin/End in order.Please help........