During my application, I'm storing a little table that contains 50 records inside a singleton class since the data within this table hardly changes - e.g. their email list of nations.

Although, the idea isn't good, I must continue it at this time. Can there be any solution in Hibernate which observe alternation in the table as well as on change, invoke an approach to a category to update the variable.

Hibernate will not get informed of changes made while dining level. The (bad) solution is always to update the information through Hibernate's API and also to use among the callback supplied by an Interceptor to complete some black miracle voodoo using the Singleton. But honestly, the (right) way additional is always to eliminate that singleton and also to place the data in second level cache (and also to invalidate the cache should you update the table by hand).

(EDIT: As ChssPly76 pointed out inside a comment, there's a middleman solution if getting rid of the singleton isn't a choice which consists in modifying the singleton to locate and return cached hibernate-handled organizations much like your nations for instance.)

Implement [cde]. Ah no, for you to do it from sleep issues on. No, it isn't possible. Best you skill would be to reload the information at certain times, for instance once every hour. You should use [cde] with this.

Nevertheless, a Interceptor#onFlushDirty() can be a bad idea. Simply have it as being some type of a characteristic from the primary context. If it's for instance an Java EE webapplication, you should use java.util.TimerTask with this.

Your circumstances sounds well suited for the L2 cache as your objects rarely change and hang your expulsion policy accordingly to refresh. Further if ALL mods are carried out through Hibernate you'll be able to keep an eye on what goes on with the events/interceptor infrastructure. Obviously, any auxiliary tables Hibernate doesn't learn about would need to be monitored by other means like how @BalusC recommended.

It appears that simplest method of this can be a trigger around the database finish rather inside your application. But this is dependent obviously around the underlying database and when you want to make use of SQL if anything else is performed by Hibernate.

Everyone keeps repeating the chant about Singletons being evil, but this mainly applies to traditional (private constructor + getInstance method) Singleton implementations, their primary disadvantages being difficult to unit make sure not robust in multi-threaded or clustered conditions. However, Spring provides a perfectly valid possibility for 'singleton' beans within its context. Simply because you will find difficulties with some (very mainstream and heard to root out) implementations does not necessarily mean the Singleton pattern is definitely bad.