Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8203415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:32:54+00:00 2026-06-07T07:32:54+00:00

Stateful session beans are often illustrated by implementing a shopping cart. Coming from outside

  • 0

Stateful session beans are often illustrated by implementing a shopping cart. Coming from outside Java EE, my inclination would be to handle this kind of state with a persistent model entity: a ShoppingCart object with Products and quantities. This way, my state is being maintained by the database along with all my other state rather than by the application server.

What are the technical advantages to stateful session bean design over “ordinary” persistence? Are shopping carts in Java EE-based web applications indeed usually written with SFSBs, or as in other systems just by more elaborate domain modeling?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:32:56+00:00Added an answer on June 7, 2026 at 7:32 am

    There are several ways to implement a shopping cart. The main difference between SFSB and DB persistence is, well, the persistence 🙂

    A Stateful session bean will only “persist” the data during the session time. So if the user session becomes inactive (for exemple after 30 minutes of inactivity), the shopping cart will be reset

    With the database persistence, the shopping cart will be stored permenantly, so if a user have a filled shopping cart, then don’t visit the webshop during 6 months, and visit it again, the cart will still be filled

    I think usually the first solution is used, as involving a non in-memory database is not a good idea to store volatile data. There will be a lot of hard drive I/O overhead for data that don’t really need long-term persistence

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some trouble accessing a stateful session bean (SFSB) from an application
I'm experimenting with EJB3 I would like to inject a stateful session bean into
I'm using a stateful session bean to create a shopping basket. I'm having trouble
Are Session Beans (stateless session beans, stateful session beans) Synchronized?
With EJB (3.x) you have a choice of Session Beans: @Stateful and @Stateless .
I'm developing a java EE web app using JSF with a shopping cart style
I'm having trouble getting sessionscoped beans and ejb stateful beans to communicate between user
I am a little unsure the different types of session beans and how to
I'm currently learning EJB and as I understand when client gets a stateful session
Seam advises using an Extended persistent context in a Stateful Session Bean, in order

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.