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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:45:46+00:00 2026-05-20T09:45:46+00:00

I have an application scoped managed bean which main purpose is to serve the

  • 0

I have an application scoped managed bean which main purpose is to serve the rest of the application with less dynamic data such as all available languages and a few more things.

ApplicationController

@ManagedBean(eager=true)
@ApplicationScoped
public class ApplicationController implements Serializable {
    private static final long serialVersionUID = 25488214212L;

    private List<Language> languages;
    private Map<Language, List<LevelDescription>> descriptionsPersonal;
    private Map<Language, List<LevelDescription>> descriptionsTechnical;
    private List<Integer> levels = new ArrayList<Integer>();

    @EJB private LanguageDao languageDao;
    @EJB private LevelDescriptionDao levelDescriptionDao;
    @EJB private IntraConnectionBean intraBean;
    @EJB private ApplicationBean appBean;

    public ApplicationController() {
    }

    @PostConstruct
    public void init(){
        languages = languageDao.findAll();
        descriptionsTechnical = new HashMap<Language, List<LevelDescription>>();
        descriptionsPersonal = new HashMap<Language, List<LevelDescription>>();
        for(int i = 0; i < 6; i++)
            levels.add(i);
        for(Language l : languages){
            List<LevelDescription> desc = levelDescriptionDao.findAll(l, true);
            if(!desc.isEmpty())
                descriptionsTechnical.put(l, desc);
            desc = levelDescriptionDao.findAll(l, false);
            if(!desc.isEmpty())
                descriptionsPersonal.put(l, desc);
        }
    }

    public List<Language> getLanguages(){
        if(lang)
        return languages;
    }

    public List<LevelDescription> getTechnicalItems(Language lang) {
        return descriptionsTechnical.get(lang);
    }

    public List<LevelDescription> getPersonalItems(Language lang) {
        return descriptionsPersonal.get(lang);
    }

    public List<Integer> getLevels(){
        return levels;
    }
}

This seems to work fine. For a while. When leaving the application alone for some time, maybe an hour, I get extremly strange behaviour. The get-methods seems to either start returning empty collections, or returning collections with objects that seem proper but doesn’t work with posting selectOneMenus. A redeploy makes it works again, which also makes it hard to experiment with since turning on debug mode will make it work again by redeploying.

What time-based event could possibly cause this? It’s not a session time out, I’ve tested setting it to a one minute and letting the session die without causing this problem, it mostly occurs in the morning after the dev-server has been running all night undisturbed. All EJBs are Stateless and I can’t imagine them being the problem. Can it be a serialization problem perhaps?

I apologize for being so diffuse, maybe I have somehow missunderstood how application scoped beans work. Any help would be appreciated.

  • 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-05-20T09:45:47+00:00Added an answer on May 20, 2026 at 9:45 am

    Just found out what my problem was: an incorrectly implemented equals method. The equals method would compare ids of objects (Long), and used == instead of Long.equals. This caused the equality to always be negative when objects lived longer than JPA cache(because their physical address would be the same until the cache got invalidated and a new object was created).

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

Sidebar

Related Questions

I have an application which extracts data from an XML file using XPath. If
I have an application which really should be installed, but does work fine when
I have an application that reads a CSV file with piles of data rows.
I have an application with multiple "pick list" entities, such as used to populate
I have a number of application settings (in user scope) for my custom grid
I have an application that sends messages to an external web service. I build
We have an application with a good amount of jQuery JSON calls to server
I have an application that displays an image inside of a Windows Forms PictureBox
I have an application deployed into multiple zones and there are some issues with
I have an application that uses NHibernate as its ORM and sometimes it experiences

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.