Most of the time, the online shopping cart is just a shopping memo, you put something in your shopping cart doesn't means you hold the the stuff other body cannot touch(keep long transaction is not good). any comments about booking the seats?
If you don't persist the shopping cart, then others cannot "touch" your cart, unless you specifically develop some way to let others "touch" it. The shopping cart is valid during your session period, it stays in the memory. The same applys to the booking seats.
Hi Annie, Thank a lot for your reply, but it seems my question is not clear enough. Say when I going to book a fight, I search the available seats, and pick up one to my "shopping cart", I don't persist it to DB at this time(otherwise I need a mechanism to clear up some unpaid booked seats). Meanwhile, somebody see that seat too, booked and checked out it before me, so I have a trouble when I want to check it out. This is common issue of online shopping cart, no harm in many senarios, but do need to be handled for booking seat. Any suggestion?
The shopping cart is just one object under the HTTP session.
After user login, the HTTP session object is create. Then you can attack the shopping cart object to the session object. How you get the shopping cart? There are many way. You can save the cart in DB, so it will be valid, for a long time, accross many login session.
Others can see you shopping cart. If you want to do so. Why not. But no one can see your session.
Hi Hu Rui, What you said is right, but is still my problem. You go to supermarket, put something in your shopping cart, nobody can take it from you if you want to check it out. but this is not the case for most online session "shopping cart". You can persist it to DB(then the session "shopping cart" may not required), but you have to clear up some uncheck-outed with some condition, say 1 hour, and within the 1 hour, nobody can touch it and the system may lose business opportunities to sale it to other person. and for online senario, many people may just want a try or any other reason to put something in their shopping cart without check-out and left their browser open and leave for long long time...I know most people using the first solution, but the potential risk is there, there are also some cons for sulotion 2.