1. User adds item 1 to cart
2. User goes to cart, changes the field of item1 to say 1000 (number must be large enough, see below) and presses update.
3 Browser displays an error page "shopping portlet not reachable"
No exception stacktrace whatsoever in any logfile.
Looking at the database table ShoppingCart, we noticed that it contains a column itemsIds.
As the name says, it stores the ids of the items in the shopping cart.
The problem is, if an item appears n times, the id is stored n times too.
It looks something like this.
11234, 11234, 11234, ...
The field is defined as nvarchar(2000). So if the user tries to buy a large enough quantity of something, in our case it was envelopes, it overflows.
1. The exception should either be propagated to the user or at least logged in something more than debug level, so it shows in a productive environment.
2. Wouldn't it be cleaner to model the relationship between ShoppingCart and ShoppingItem properly as an m:n ?
Introduce supplementary table, say ShoppingCartItem. Similar to ShoppingOrderItem.