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;)
Werner Punz <[EMAIL PROTECTED]> wrote on 30.12.2004 23:18:20:
> Well, I posted the question a few days ago,
> but back then the new list on Apache sort of was
> empty, never got an answer. I try to post it again, now that the list
> has picked up momentum.
>
> I have following problem.
> I want to have a Hibernate backed backend bean which I want
> to connect to a datascroller/datatable combination.
>
> The problem I see with the current API is, that it seems to be
> either resultset, with a permanent open db connection and
> plain jdbc, or load the entire resultset into the ram
> and "shove" it into the datatable.
>
> Now both combinations are not exactly what I want, I want
> to have the connections not totally open all the time (the framework
> will take care of it anyway once not used anymore)
> and I want only the visible scope of database objects loaded.
>
> My idea which I have been thinking about would be some kind of proxy
> patterned list which is given to the datatable.
> The list basically only loads one single page at a time and then closes
> the connection but is giving the full size and keeping the page size for
> the paging and the page pos.
> (Even with the problem that this thing can be altered between
> page requests during scroll operations by another user)
>
> But my question is, am I correct with the assumption that writing a
> proxy list is the cleanest way to reach my goals, or is there another
> solution which might be cleaner and easier to implement (like an already
> implemented solution which already does this or an existing hibernate
> hook of the myfaces components in CVS?)
>
> Werner
- Re: Datascroller question again carsten
- Re: Datascroller question again Werner Punz

