[EMAIL PROTECTED] wrote:


Hi. I am using Hibernate and MyFaces too. As data connections are a rare resource I try to use them as short as possible. So in the case of a data table I have a FactoryMethod like
List getItems(String sortColum, boolean ascending);
and
List getItems(String sortColum, boolean ascending, Long pos, Long fetchsize);
where I open the conection, retrieve the objects, close the connection and return the result. The tricky part is the caching. I am using different approaches as it realy depends on the data shown. For an user list shown as information for other customers it could be not important to see new users before a half hour, where you can use a asynchrounous cache were the update depends of time or is triggered by jms or similar. The bad thing about databases are the limited resources of connections. Once run out of connections your application will stale as most of the internet users will try to reload the page which leads to even more load on the database. On the opposite side, (a)synchronized caches can be a performance killer for the application servers. So choose your poison *g*
I try to use no cache at all at the beginning of a project, but be prepared to activate different ones for different views/kind of objects. I would realy like to use a database cluster or even better a data grid, but this is way out of my budget:(
The conclusion is: there is no 'one' solution to your problem. I would use the simplest and tune the application in a general way so you can react on the specific application behaviour. I am using aspectj to alter the caches so maybe i could you be from some help;)



Actually caching is a none issue, due to various reasons. Hibernate has excellent caching itself, and the data operations
are basically performed on plain tables, so access should be fast anyway (not too many users).
The connection problem indeed is there, but having used
hibernate already a few times, you have to jugde for yourself and keep the connection time as low as possible, as you said.
The hibernate caching still works well in that case.


The main problem more that I was looking sort of for the best option to marry hibernate with the datascroller (existing if possible) with the least work possible. I got several hints and will check them out.





Reply via email to