Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-29205

updateCart fails with SQLServer because itemIds field gets too large

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Inactive
    • Affects Version/s: 6.0.6 GA
    • Fix Version/s: None
    • Component/s: Util, Util > Shopping
    • Labels:
      None
    • Environment:
      Microsoft SQL Server 10.00.5500
      jTDS Type 4 JDBC Driver for MS SQL Server and Sybase 1.2.5
      Glassfish 3.1

      Description

      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.

      Suggestions:

      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.

        Attachments

          Activity

            People

            • Assignee:
              michael.saechang Michael Saechang
              Reporter:
              ana.oleski Ana Oleski (Inactive)
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                7 years, 25 weeks ago

                Packages

                Version Package