I would like to know how "expensive" an extended application scoped persistence context is.
I.e. I have a menu consisting out of 1000+ elements that I need for every request. Therefore I would like to cache it - naturally in the application scope.
Now, instead of reading the whole menu on server startup, i thought about using an extended persistence context so already loaded stuff is reused and new stuff gets loaded from the DB (less work than manually loading the whole menu data in some structure).
Is this bad practice or a good idea ?
That is definitely NOT the right way to think about extended persistence contexts. Their "cache" goes away at the end of the conversation.
Put stuff in the application context, or use a Hibernate second-level cache.