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 8715357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:49:27+00:00 2026-06-13T05:49:27+00:00

I have information stored in a database (actually a content repository but this shouldn’t

  • 0

I have information stored in a database (actually a content repository but this shouldn’t matter) which should be presented to all users. Currently I have a Singleton Bean which fetches this information and stores it in a variable. This fetch operation is called every time an update happen on the database so that the variable, representing the database content, is always up to date. Also this variable is used by jsf managed beans to display the information. What I wanted to avoid with this approach is that a new database connection has to be opened for every read-only request. Does this approach make sense or should I use an application scoped managed bean instead? I would then have to call the update method of the managed bean from within an EJB. Is there something wrong with doing this?

  • 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-13T05:49:28+00:00Added an answer on June 13, 2026 at 5:49 am

    If you would like to persist information across all sessions of a given web application in JSF then it is best to use Application Scoped and not use a static singleton.

    Here are a few reasons why:

    1. Static fields are based on the class loaded in a specific VM. If your application were to be load balanced or clustered then there is no chance that other application server nodes will have access to the information stored on another servers VM.

    2. ApplicationScoped beans can be serializable, meaning that certain web and application containers have the ability to persist these scoped beans to disk in the event of a server restart. This is dependent on the functionality of your given server however.

    3. Certain application servers have good clustering support as well as sticky sessions and global cluser wide application scope. This will allow sessions to be routed to another server successfully if the current sessions server would unexpectedly go down. Also ApplicationScoped beans would be public and accessible everywhere throughout your application regardless of which node is serving a given request. Again, this is highly dependent on the application containers features and configuration.

    4. Static fields would not only be accessible to every request on a given application’s VM, it will be available to EVERY request on EVERY application running on a given VM. If the application server or web container is running multiple web application and they both utilize the same classes then they could be inadvertently sharing information or clashing with each other. Not a good design choice.

    For more information see below:

    https://blogs.oracle.com/groundside/entry/application_scope_v_s_static

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

Sidebar

Related Questions

I have information stored in a database that I want to use to create
I have a database which stores (among other things), the following pieces of information:
I have these roles:Admin, Doctor and Patient. But login information is stored in different
I created a database (scriptDB) and have stored information (more than 40 properties of
So I've got this database that helps organize information for academic conferences, but we
i have taken over a database that stores fitness information and we were having
Our scenario: We have a main database that stores company-wide information. We have several
I am trying to match information stored in a variable. I have a list
Did you ever have the following situation: you need to store information, but a
I have multimedia files and its metadata stored in a RDBMS (actually, the actual

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.