I'm using an object 'domainHome extends EntityHome' in my application for managing the entity called 'Domain'.
I have an admin and frontend in my system.
I have a method called loadScenario which drops all tables and then sets up a new Domain entity.
After the new domain is persisted the loadScenario also does the following
Because domainHome is Application scoped I would expect that all conversations now have the new domain. (when they invoke domainHome.getInstance()).
This is not the case. It only works when I set the scope to CONVERSATION?
I don't understand why this only works when domainhome scope is CONVERSATION and not when the scope is APPLICATION.
My current solution is also not very good, because each conversation will have it's own instance of domainHome, which needs to be reloaded because loadScenario has run.
Can someone please explain?
Keep the home in conversation scope, but the object id in application scope, and reload it when necessary. And just run your loadScenario when you haven't got the id available (when the app starts)