Shlomo wrote:
ohh, There is a table named "CONSTANTS" that holds all the contants of course.
I actually see this more as a general design issue than a Hibernate issue but either way...
If the objects are updated through the app, and therefore using Hibernate, you can configure the L2 cache so that each time you "read" the object, hibernate will retrieve it from the cache instead of the database.
You could also just set up a HashMap that is accessible to the application through a static helper class or JNDI or however, which maps the keys to the Constant POJO objects.
The important decision comes from how the data in the application gets updated if the data in the database is modified outside of hiberate - if using the L2 Cache support, and how it gets updated in the HashMap if not.
With L2 Cache, updating through Hibernate should keep the cache properly maintained. If it is updated through some other mechanism, you can configure an expiration policy that will cause the cache to be invalidated/reloaded at specific intervals.
If you use a HashMap, you're on your own as far as keeping it current.