Results 1 to 3 of 3
Thread: Negative stock problem !
- 12-15-2012, 01:19 PM #1
Member
- Join Date
- Dec 2012
- Posts
- 1
- Rep Power
- 0
Negative stock problem !
Hello,
I am trying to conceive it a website selling books online with architecture Struts2-Spring-JPA / Hibernate.
I confronted the problem of negative stock .. I explain:
When two customers require almost the same time a product of a quantity x, an audit is triggered to check if the stock available is greater than or equal to the amount requested. If two control the quantity x (and possibly purchase) happen at the same moment, it is obvious that one of the clients will exhaust the quantity x before the other, which leads to the problem of negative stock for the second customer.
So I thought to force the application to force the existence of a single instance of every book at a given time for access to its stock available at time t. (Mutual exclusion)
Suffice it to add the attribute in the declaration of singleton bean Action (Class business processing defined in applicationContext.xml) with additional treatment in the method for pool access?
There are another solution?
Thank you in advance for your help.Last edited by DarrylBurke; 12-15-2012 at 02:11 PM. Reason: Removed annoying all-bold formatting
- 12-15-2012, 02:13 PM #2
Re: Negative stock problem !
Don't format your entire post in bold as that makes it difficult to read. I've removed the bold tags.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 12-16-2012, 01:36 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
The Stock Class
By luckyirish in forum New To JavaReplies: 9Last Post: 07-13-2011, 04:40 AM -
Stock exchange program
By askinne2 in forum New To JavaReplies: 2Last Post: 05-02-2010, 11:25 PM -
string to negative int problem
By pendulum101 in forum New To JavaReplies: 5Last Post: 11-01-2009, 05:47 PM -
Stock Quotes
By BartDR in forum Advanced JavaReplies: 0Last Post: 09-15-2009, 09:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks