J2EE inventory management lock Product quantity
We are trying to develop web e-commerce application using struts 1.2 on Jboss 4.2.+MySQL DB 5.1 which needs to be clustered. Need guidance before we start coding. We are stuck up.
We have a Product table where we are entering the quantity , A Order table where we are storing the Customer order & Product details related to add to cart functionality. There is a requirement which states that if a customer adds a Product to shopping cart with number of quantity, its should reduce from the Product table (the idea being to so that next customer can get the available quantity product). So how do we handle this in web e.g: A product total quantity is 15, Customer A comes & books for 12 , parallel Customer B comes & books for 6. How to lock & handle for the other scenario
1) So how do we lock product quantity this for each customer in web application (also clustered, synchronization may not work in clustered env as I think JVM would be different), Any other way?
2) what if the customer does not complete the shopping functionality, I mean we need to revert back the quantity from shopping cart to Product table?
|