How are your categories being updated? If your app is the only one that writes to the DB via Hibernate, then using a long lived Hibernate cache probably makes sense. If however you need to handle out of band writes, you'll need some way for the writing process to trigger an invalidation/reload of your category cache. You could write a web service here, or have some other communication mechanism. Otherwise you'll need to check on every request.
If getting it close is good enough, you could use a Hibernate cache that reloads every so often (timeout is configurable). There is risk that you'll be out of date, but you'll only be at most 1 time period out of date. Make this an hour, a day, whatever and you've cut down DB requests significantly.
thank you for your reply!
I got an userfront and an adminfront, the userfront should only read the categories and the admin should also be able to change the categories.
How can I setup a timeout for only one entity? And can I give an entity more than one cache startegies?
Anyway, I'm still intrested in if there is a possibility to invalidate the Application scope (maybe a seam core function)
Couldn't you simply outject a new component to replace your stale application scoped guy? You could also have a smarter component that could poll and refresh on a regular basis. Not exactly sure what the invalidation question is.
There is a lot more documentation on Hibernate and its configuration options. You can set cache options per class or collection mapping. To drastically reduce your DB hits, you could mark the class read-only and then specify the timeout by which it refreshes the cache anyway. Don't have the exact notation for specifying the time out, but the Hibernate docs or forums should.