Discussions

EJB design: design pattern for application level constants/globals

  1. design pattern for application level constants/globals (1 messages)

    Hi,

    I am trying to find a design pattern for application level constants/globals. Basically, database stores some integer value - which has to be mapped to corresponding text and back.
    e.g.:

    Display Text text used by program Table stored value
    ------------ -------------------- ------------------
    3 Cheese threeCheese 10
    Pepperoni pepperoni 20
    Red Onions onion 30
    Green Peppers greenPepper 40
    BBQ Chicken bbqChicken 50

    Is there any design pattern/guideline that will let me do this 3 way mapping? Solution I am thinking of involves having 2 hash tables - but I think it has to be easier than that.

    Thanks,
    - PI
  2. May be you should try creating a datastructure containing all the three values..

    Then all you have is an array of the dataStructure, and on itereating the array, you can map from any type to any type.

    Hope this helps.

    Thanks,
    Rakesh.