views:

54

answers:

1

Hello ...

I'm developing java EE database application(JSF) where I fill drop down menus from database. I looked for some tutorials and I find that they used the session bean to initialize these drop down values from database (using hibernate).As my application contains a lot of these is this a good strategy to fill values from database?

Is there any other approach to implement this? Is using backing bean for filling drop downs a good Idea?

Thanks all

Feras

+2  A: 

I'd just load it in the constructor of an application scoped bean and use it to fill the dropdowns.

I would maybe add a background task to reload the data in the bean at certain intervals, e.g. daily, depending on how often the data will be updated.

BalusC
But is this a good Idea to fill all it all at application startup as may be big part of them will not be used?
Feras
It's at least more efficient than doing it in a session scoped bean since you're then basically duplicating the data in Java's memory for every unique visitor.
BalusC