This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In a JSP file I have a customerID which is stored in a session. This customerID I use to recieve (select only) some customer information from a database, through a java class. I have doubt about if there can be any synchronization problems, if more users is accessing the page the same time, and i.e. CUSTOMER A is recieving CUSTOMER B�s information and visa versa?
//In the jsp page, this method call the java class to select data from database user.dataObject.User obj_user = obj_order.getCustomerInformation( customerID );
//Here I get the customer Name in the jsp page String customerName = obj_user.getCustomerName();
Is it necessary to synchronize the method, which do the select query in the Java class to avoid that CUSTOMER A is recieving CUSTOMER B�s information? [ November 30, 2005: Message edited by: Jeppe Fjord ]
couple things to keep in mind.. in your javabean obj_order.getCustomerInformation() make sure you're doing a "new" object creation so that each jsp call gets a new memory location. if you merely reuse a class variable or a static instance of that then you will have data corruption. assuming that's not the problem, as long as the variable is in session scope you theorectically shouldn't have to worry about customer b accessing customer a stuff.
it's kinda hard to tell from your code that you've posted.