Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Should I use one to many relationship for this case between Cart and Products?

 
Monica Shiralkar
Ranch Hand
Posts: 873
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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





 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic