posted 9 years ago
Should I use one to many relationship for the below case between Cart and Products:
I am implementing a shopping cart where user will add products to his shopping cart.
Also on clicking 'show cart' option the products in the cart will be listed. Which of the following ways should I use:
case 1:
Do not use any one to many mapping between cart and products table. And on click of 'show cart' button use HQL query such as "from Cart where cart id=
Case 2:
Use one to many mapping between cart and products and get get items using the getCartProducts method?
thanks