In a Web App, need to display a view of 6 objects (rows of table DB) via JSF per page. To advance to the next view another different random 6 objects are to be displayed and so on...
So I was thinking in having a @Singleton that queries all the rows of the table with a @Schedule job in a given interval, let's say every 1 hour. It will have a getCollection() method.
Then every visitor will have a @SessionScoped CDI bean, that will query the Collection of the @Singleton, then shuffle it to make a random view to the specific user.
As with many visits, many CDI beans will be created that will access the getCollection() method concurrently.
Is this thought correctly? Any specific annotations are needed for this case? Any other way of doing this?
-----UPDATE---
After speaking with friends, specially Luiggi Mendoza, they tell me that best thing here is to use a EHCACHE or similar, instead of a Singleon. I think that's the way.