Hi,
when it comes that you feed a suggestion box with data from a database (e.g. via hibernate) it comes to the following problem:
Lets assume you have written your autocomplete() function and it loads the data via hibernate. With every keypunch the db would be queried, which is with multiple users at a time definitely too much.
Of course there are params like requestDelay which would reduce this queries but as a matter of fact it would make more sense to keep the data you got from the first query bc it already contains the results you need to display the next times.
So my approach was to give my managed bean session scope and change my autocomplete() function the following way: I added a List "resultList" and now, only when 2 letters are in the box a db query is made. The result of this query is saved in the resultList. Next time, if more than 2 letters are there the results will be taken out of this list, which is much faster and you only query the db once. I configured the suggestionbox with:
minChars="2" eventsQueue="sug"