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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:19:01+00:00 2026-06-15T07:19:01+00:00

After reading lot of posts i am planning to use below approach to pull

  • 0

After reading lot of posts i am planning to use below approach to pull reference data from database (code not tested yet).

    @Override
    protected Map referenceData(HttpServletRequest request) throws Exception {

        //Data referencing for country list box
        Map referenceData = new HashMap();
        referenceData.put("countryList", articleService.getCountryList());

        //Data referencing for skills list box
        Map<String,String> javaSkill = new LinkedHashMap<String,String>();
        referenceData.put("skillsList", articleService.getSkillsList());

        return referenceData;
    }

Reference data table is as below

id  key     value               type
-----------------------------------------
1   1       United States       countries
2   2       India               countries
3   3       United Kingdom      countries
4   4       China               countries
5   1       Java                skills
6   2       Spring              skills
7   3       Hibernate           skills
8   4       SQL                 skills

I have got two questions,

  1. This is a static reference data (i wont change it for months), so I dont want to hit database for every request and data should be loaded on server startup instead. How to do this?
  2. Is this the correct approach or i am complately wrong in understanding it?
  • 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-15T07:19:02+00:00Added an answer on June 15, 2026 at 7:19 am

    No, I would say it’s a correct approach. You should put countries in their own table, and skills in their own table.

    First because additional column will inevitably appear for countries, which don’t make any sense for skills (or vice-versa).

    And second because you will want to reference countries or skills from other tables in your database (and other entities in your object model). So you’ll want to have foreign keys from addresses to countries, for example, and you wouldn’t want an address to reference a skill rather than a country. And you’ll want a ManyToOne association from Address to Country, and not from Address to ReferenceTable.

    I have the feeling that you’re pre-optimizing. Such reference tables are small, and the database will hold everything in memory. So querying them, even if you do it frequently, will be extreely fast.

    If you want to avoid those queries completely, then you could simply use the second-level cache of hibernate, which will make everything transparent (i.e. you will keep programming as usual, and Hibernate will go to its cache instead of going to the database). This will bring additional advantages, such as being able to actually update information in those tables without getting stale values for too long (or without getting stale values at all).

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

Sidebar

Related Questions

I think this has probably been asked, but after reading a lot, I'm not
After reading monkeytalk faq from http://www.gorillalogic.com/testing-tools/monkeytalk/documentation/monkeytalk-faq : How does it all work? MonkeyTalk is
After reading MSDN-XAML Namespaces and MSDN-Understanding XAML Namespaces , I still do not understand
After reading several articles of a hierarchical data tables, I've made my way into
After reading this article, it makes sense to rebase to gather changes from the
After reading the tips from this great Nettuts+ article I've come up with a
The Jquery code below works ok with firefox, Safari, Opera but not with IE.
I know I'm asking for a lot in this post but after reading 4
After reading a lot of on the subject I'm still in the dark about
I've never used these functions before but after reading a lot about sprintf(), I

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.